1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include <com/sun/star/accessibility/XAccessible.hpp>
24 #include "keyboardfocuslistener.hxx"
26 #include <tools/link.hxx>
27 #include <vcl/vclevent.hxx>
30 namespace vcl
{ class Window
; }
32 class DocumentFocusListener
;
35 class AquaA11yFocusTracker
39 AquaA11yFocusTracker();
41 ~AquaA11yFocusTracker();
43 css::uno::Reference
< css::accessibility::XAccessible
> const & getFocusedObject() { return m_xFocusedObject
; };
45 // sets the currently focus object and notifies the FocusEventListener (if any)
46 void setFocusedObject(const css::uno::Reference
< css::accessibility::XAccessible
>& xAccessible
);
48 // may evolve to add/remove later
49 void setFocusListener(const rtl::Reference
< KeyboardFocusListener
>& aFocusListener
) { m_aFocusListener
= aFocusListener
; };
53 // received a WINDOW_GETFOCUS event for this window
54 void window_got_focus(vcl::Window
*pWindow
);
56 // received a TOOLBOX_HIGHLIGHT event for this window
57 void toolbox_highlight_on(vcl::Window
*pWindow
);
59 // received a TOOLBOX_HIGHLIGHTOFF event for this window
60 void toolbox_highlight_off(vcl::Window
const *pWindow
);
62 // received a TABPAGE_ACTIVATE event for this window
63 void tabpage_activated(vcl::Window
*pWindow
);
65 // received a MENU_HIGHLIGHT event for this window
66 void menu_highlighted(const ::VclMenuEvent
*pEvent
);
68 // toolbox items are widgets in gtk+ and Cocoa
69 void notify_toolbox_item_focus(ToolBox
*pToolBox
);
71 // toolbox item opened a floating window (e.g. color chooser)
72 void toolbox_open_floater(vcl::Window
*pWindow
);
74 // callback function for Application::addEventListener
75 static void WindowEventHandler(void * pThis
, VclSimpleEvent
&);
78 // the accessible object that has the keyboard focus (if any)
79 css::uno::Reference
< css::accessibility::XAccessible
> m_xFocusedObject
;
81 // the listener for focus events
82 rtl::Reference
< KeyboardFocusListener
> m_aFocusListener
;
84 // the list of Windows that need deeper (focus) investigation
85 std::set
<VclPtr
<vcl::Window
>> m_aDocumentWindowList
;
87 // the link object needed for Application::addEventListener
88 Link
<VclSimpleEvent
&,void> m_aWindowEventLink
;
90 // the UNO XAccessibilityEventListener for Documents and other non VCL objects
91 const rtl::Reference
< DocumentFocusListener
> m_xDocumentFocusListener
;
94 AquaA11yFocusTracker
& TheAquaA11yFocusTracker();
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */