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 .
20 #ifndef _AQUA11YFOCUSTRACKER_HXX_
21 #define _AQUA11YFOCUSTRACKER_HXX_
23 #include <com/sun/star/accessibility/XAccessible.hpp>
25 #include "keyboardfocuslistener.hxx"
27 #include <rtl/instance.hxx>
29 #include <tools/link.hxx>
30 #include <vcl/vclevent.hxx>
35 class DocumentFocusListener
;
37 // ------------------------
38 // - AquaA11yFocusTracker -
39 // ------------------------
41 class AquaA11yFocusTracker
: public rtl::Static
< AquaA11yFocusTracker
, AquaA11yFocusTracker
>
45 AquaA11yFocusTracker();
47 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> getFocusedObject() { return m_xFocusedObject
; };
49 // sets the currently focus object and notifies the FocusEventListener (if any)
50 void setFocusedObject(const ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
>& xAccessible
);
52 // may evolve to add/remove later
53 void setFocusListener(const rtl::Reference
< KeyboardFocusListener
>& aFocusListener
) { m_aFocusListener
= aFocusListener
; };
57 // received a WINDOW_GETFOCUS event for this window
58 virtual void window_got_focus(Window
*pWindow
);
60 // received a TOOLBOX_HIGHLIGHT event for this window
61 virtual void toolbox_highlight_on(Window
*pWindow
);
63 // received a TOOLBOX_HIGHLIGHTOFF event for this window
64 virtual void toolbox_highlight_off(Window
*pWindow
);
66 // received a TABPAGE_ACTIVATE event for this window
67 virtual void tabpage_activated(Window
*pWindow
);
69 // received a MENU_HIGHLIGHT event for this window
70 virtual void menu_highlighted(const ::VclMenuEvent
*pEvent
);
72 // toolbox items are widgets in gtk+ and Cocoa
73 virtual void notify_toolbox_item_focus(ToolBox
*pToolBox
);
75 // toolbox item opened a floating window (e.g. color chooser)
76 virtual void toolbox_open_floater(Window
*pWindow
);
78 // callback function for Application::addEventListener
79 static long WindowEventHandler(AquaA11yFocusTracker
*pFocusTracker
, ::VclSimpleEvent
const *pEvent
);
82 // the accessible object that has the keyboard focus (if any)
83 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> m_xFocusedObject
;
85 // the listener for focus events
86 rtl::Reference
< KeyboardFocusListener
> m_aFocusListener
;
88 // the list of Windows that need deeper (focus) investigation
89 std::set
< Window
*> m_aDocumentWindowList
;
91 // the link object needed for Application::addEventListener
92 Link m_aWindowEventLink
;
94 // the UNO XAccessibilityEventListener for Documents and other non VCL objects
95 const ::com::sun::star::uno::Reference
< DocumentFocusListener
> m_xDocumentFocusListener
;
98 #endif // _AQUA11YFOCUSTRACKER_HXX_
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */