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

Resolves; tdf#87120 no keyboard navigation inside floating windows

lets try and treat these the same as we do normal toplevels
like dialogs if they popup with GrabFocus.

This way focus can be set on widgets inside the floating windows, and
so keyboard traversal of widgets etc all works.

Change-Id: If447429756cf5d136b9c2e2f62fafb37c167b1ce
üst 92d43df8
......@@ -186,7 +186,6 @@ public:
virtual void Command( const CommandEvent& rCEvt ) override;
virtual void StateChanged( StateChangedType nType ) override;
virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
virtual vcl::Window* GetPreferredKeyInputWindow() override;
virtual void Modify();
virtual void UpdateData();
......
......@@ -134,7 +134,6 @@ public:
virtual void DoubleClick();
virtual void GetFocus() override;
virtual void LoseFocus() override;
virtual vcl::Window* GetPreferredKeyInputWindow() override;
virtual const Wallpaper& GetDisplayBackground() const override;
......
......@@ -824,7 +824,6 @@ public:
virtual void DataChanged( const DataChangedEvent& rDCEvt );
virtual bool PreNotify( NotifyEvent& rNEvt );
virtual bool Notify( NotifyEvent& rNEvt );
virtual vcl::Window* GetPreferredKeyInputWindow();
// These methods call the relevant virtual method when not in/post dispose
void CompatGetFocus();
......
......@@ -1327,11 +1327,6 @@ void ScCheckListMenuWindow::Paint(vcl::RenderContext& rRenderContext, const Rect
rRenderContext.DrawRect(Rectangle(aPos,aSize));
}
vcl::Window* ScCheckListMenuWindow::GetPreferredKeyInputWindow()
{
return maTabStops.GetCurrentControl();
}
Reference<XAccessible> ScCheckListMenuWindow::CreateAccessible()
{
if (!mxAccessible.is())
......
......@@ -299,7 +299,6 @@ public:
virtual void MouseMove(const MouseEvent& rMEvt) override;
virtual bool Notify(NotifyEvent& rNEvt) override;
virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) override;
virtual vcl::Window* GetPreferredKeyInputWindow() override;
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
void setMemberSize(size_t n);
......
......@@ -347,8 +347,6 @@ public:
ScFilterFloatingWindow( vcl::Window* pParent, WinBits nStyle = WB_STDFLOATWIN );
virtual ~ScFilterFloatingWindow();
virtual void dispose() override;
// required for System FloatingWindows that will not process KeyInput by themselves
virtual vcl::Window* GetPreferredKeyInputWindow() override;
};
ScFilterFloatingWindow::ScFilterFloatingWindow( vcl::Window* pParent, WinBits nStyle ) :
......@@ -366,12 +364,6 @@ void ScFilterFloatingWindow::dispose()
FloatingWindow::dispose();
}
vcl::Window* ScFilterFloatingWindow::GetPreferredKeyInputWindow()
{
// redirect keyinput in the child window
return GetWindow(GetWindowType::FirstChild) ? GetWindow(GetWindowType::FirstChild)->GetPreferredKeyInputWindow() : nullptr; // will be the FilterBox
}
static bool lcl_IsEditableMatrix( ScDocument* pDoc, const ScRange& rRange )
{
// If it is a editable range and if there is a Matrix cell at the bottom right with an
......
......@@ -73,7 +73,6 @@ public:
bool IsUserSelected() const { return bUserSel; }
void SetUserSelected( bool bVal ) { bUserSel = bVal; }
virtual vcl::Window* GetPreferredKeyInputWindow() override;
};
SvxPopupWindowListBox::SvxPopupWindowListBox(sal_uInt16 nSlotId, const OUString& rCommandURL, sal_uInt16 nId, ToolBox& rTbx)
......@@ -128,13 +127,6 @@ void SvxPopupWindowListBox::StateChanged(
SfxPopupWindow::StateChanged( nSID, eState, pState );
}
vcl::Window* SvxPopupWindowListBox::GetPreferredKeyInputWindow()
{
// allows forwarding key events in the correct window
// without setting the focus
return m_pListBox->GetPreferredKeyInputWindow();
}
SvxListBoxControl::SvxListBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
:SfxToolBoxControl( nSlotId, nId, rTbx ),
pPopupWin ( nullptr )
......
......@@ -259,7 +259,6 @@ private:
protected:
virtual void Resize() override;
virtual bool Close() override;
virtual vcl::Window* GetPreferredKeyInputWindow() override;
virtual void GetFocus() override;
public:
......@@ -285,9 +284,7 @@ private:
protected:
virtual void Resize() override;
virtual bool Close() override;
virtual vcl::Window* GetPreferredKeyInputWindow() override;
virtual void GetFocus() override;
virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
public:
SvxLineWindow_Impl( sal_uInt16 nId, const Reference< XFrame >& rFrame, vcl::Window* pParentWindow );
virtual ~SvxLineWindow_Impl() { disposeOnce(); }
......@@ -1659,11 +1656,6 @@ void SvxFrameWindow_Impl::dispose()
SfxPopupWindow::dispose();
}
vcl::Window* SvxFrameWindow_Impl::GetPreferredKeyInputWindow()
{
return aFrameSet.get();
}
void SvxFrameWindow_Impl::GetFocus()
{
if (aFrameSet)
......@@ -2043,28 +2035,11 @@ bool SvxLineWindow_Impl::Close()
return SfxPopupWindow::Close();
}
vcl::Window* SvxLineWindow_Impl::GetPreferredKeyInputWindow()
{
return m_aLineStyleLb.get();
}
void SvxLineWindow_Impl::GetFocus()
{
m_aLineStyleLb->GrabFocus();
}
void SvxLineWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt )
{
SfxPopupWindow::DataChanged( rDCEvt );
#if 0
if( ( rDCEvt.GetType() == DataChangedEventType::SETTINGS ) && ( rDCEvt.GetFlags() & AllSettingsFlags::STYLE ) )
{
CreateBitmaps();
Invalidate();
}
#endif
}
SfxStyleControllerItem_Impl::SfxStyleControllerItem_Impl(
const Reference< XDispatchProvider >& rDispatchProvider,
sal_uInt16 nSlotId, // Family-ID
......
......@@ -406,7 +406,6 @@ public:
virtual void Resize() override;
virtual const Wallpaper& GetDisplayBackground() const override;
virtual vcl::Window* GetPreferredKeyInputWindow() override;
sal_Int32 InsertEntry( sal_Int32 nPos, const OUString& rStr );
sal_Int32 InsertEntry( sal_Int32 nPos, const OUString& rStr, const Image& rImage );
......
......@@ -1945,14 +1945,6 @@ void Edit::GetFocus()
Control::GetFocus();
}
vcl::Window* Edit::GetPreferredKeyInputWindow()
{
if ( mpSubEdit )
return mpSubEdit->GetPreferredKeyInputWindow();
else
return this;
}
void Edit::LoseFocus()
{
if ( mpUpdateDataTimer && !mbIsSubEdit && mpUpdateDataTimer->IsActive() )
......
......@@ -2224,11 +2224,6 @@ void ImplListBox::GetFocus()
Control::GetFocus();
}
vcl::Window* ImplListBox::GetPreferredKeyInputWindow()
{
return maLBWindow.get();
}
void ImplListBox::Resize()
{
Control::Resize();
......
......@@ -496,19 +496,6 @@ void ListBox::GetFocus()
Control::GetFocus();
}
vcl::Window* ListBox::GetPreferredKeyInputWindow()
{
if ( mpImplLB )
{
if( IsDropDownBox() )
return mpImplWin->GetPreferredKeyInputWindow();
else
return mpImplLB->GetPreferredKeyInputWindow();
}
return Control::GetPreferredKeyInputWindow();
}
void ListBox::LoseFocus()
{
if( IsDropDownBox() )
......
......@@ -488,7 +488,6 @@ public:
virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
virtual void Tracking( const TrackingEvent& rTEvt ) override;
virtual void Resize() override;
virtual vcl::Window* GetPreferredKeyInputWindow() override;
Rectangle GetDragRect() const;
Point GetToolboxPosition() const;
......@@ -536,14 +535,6 @@ css::uno::Reference< css::accessibility::XAccessible > ImplPopupFloatWin::Create
return css::uno::Reference< css::accessibility::XAccessible >();
}
vcl::Window* ImplPopupFloatWin::GetPreferredKeyInputWindow()
{
if( mpWindowImpl->mpClientWindow )
return mpWindowImpl->mpClientWindow;
else
return FloatingWindow::GetPreferredKeyInputWindow();
}
void ImplPopupFloatWin::ImplSetBorder()
{
// although we have no border in the sense of a borderwindow
......@@ -1152,7 +1143,7 @@ void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox, FloatWin
{
// send HOME key to subtoolbar in order to select first item
KeyEvent aEvent( 0, vcl::KeyCode( KEY_HOME ) );
mpFloatWin->GetPreferredKeyInputWindow()->KeyInput( aEvent );
mpFloatWin->KeyInput(aEvent);
}
}
......
......@@ -715,6 +715,8 @@ void FloatingWindow::StartPopupMode( const Rectangle& rRect, FloatWinPopupFlags
{
// force key input even without focus (useful for menus)
mbGrabFocus = true;
mpWindowImpl->mpFrameData->mbHasFocus = true;
GrabFocus();
}
Show( true, ShowFlags::NoActivate );
}
......
......@@ -273,9 +273,7 @@ void Window::ImplGrabFocus( GetFocusFlags nFlags )
vcl::Window *pParent = this;
while( pParent )
{
// #102158#, ignore grabfocus only if the floating parent grabs keyboard focus by itself (GrabsFocus())
// otherwise we cannot set the focus in a floating toolbox
if( ( (pParent->mpWindowImpl->mbFloatWin && static_cast<FloatingWindow*>(pParent)->GrabsFocus()) || ( pParent->GetStyle() & WB_SYSTEMFLOATWIN ) ) && !( pParent->GetStyle() & WB_MOVEABLE ) )
if ((pParent->GetStyle() & WB_SYSTEMFLOATWIN) && !(pParent->GetStyle() & WB_MOVEABLE))
{
bMustNotGrabFocus = true;
break;
......
......@@ -3443,13 +3443,6 @@ void Window::DrawSelectionBackground( const Rectangle& rRect,
SetLineColor( oldLineCol );
}
// controls should return the window that gets the
// focus by default, so keyevents can be sent to that window directly
vcl::Window* Window::GetPreferredKeyInputWindow()
{
return this;
}
bool Window::IsScrollable() const
{
// check for scrollbars
......
......@@ -821,10 +821,7 @@ static vcl::Window* ImplGetKeyInputWindow( vcl::Window* pWindow )
if( !pChild || ( pChild->ImplGetWindowImpl()->mbFloatWin && !static_cast<FloatingWindow *>(pChild)->GrabsFocus() ) )
pChild = pWindow->ImplGetWindowImpl()->mpFrameData->mpFocusWin;
else
{
// allow floaters to forward keyinput to some member
pChild = pChild->GetPreferredKeyInputWindow();
}
pChild = pChild->ImplGetWindowImpl()->mpFrameData->mpFocusWin;
// no child - than no input
if ( !pChild )
......
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