merge the formfield patch from ooo-build
[ooovba.git] / vcl / aqua / inc / aqua11yfocustracker.hxx
blob1f359ad0232ffb5d493fa8fb4a7f7f1057949b25
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: aqua11yfocustracker.hxx,v $
11 * $Revision: 1.3 $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
32 #ifndef _AQUA11YFOCUSTRACKER_HXX_
33 #define _AQUA11YFOCUSTRACKER_HXX_
35 #ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_HPP_
36 #include <com/sun/star/accessibility/XAccessible.hpp>
37 #endif
39 #include "keyboardfocuslistener.hxx"
41 #include <rtl/instance.hxx>
43 #include <tools/link.hxx>
44 #include <vcl/vclevent.hxx>
45 #include <set>
47 class Window;
48 class ToolBox;
49 class DocumentFocusListener;
51 // ------------------------
52 // - AquaA11yFocusTracker -
53 // ------------------------
55 class AquaA11yFocusTracker : public rtl::Static< AquaA11yFocusTracker, AquaA11yFocusTracker>
58 public:
59 AquaA11yFocusTracker();
61 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > getFocusedObject() { return m_xFocusedObject; };
63 // sets the currently focus object and notifies the FocusEventListener (if any)
64 void setFocusedObject(const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& xAccessible);
66 // may evolve to add/remove later
67 void setFocusListener(const rtl::Reference< KeyboardFocusListener >& aFocusListener) { m_aFocusListener = aFocusListener; };
69 protected:
71 // received a WINDOW_GETFOCUS event for this window
72 virtual void window_got_focus(Window *pWindow);
74 // received a TOOLBOX_HIGHLIGHT event for this window
75 virtual void toolbox_highlight_on(Window *pWindow);
77 // received a TOOLBOX_HIGHLIGHTOFF event for this window
78 virtual void toolbox_highlight_off(Window *pWindow);
80 // received a TABPAGE_ACTIVATE event for this window
81 virtual void tabpage_activated(Window *pWindow);
83 // received a MENU_HIGHLIGHT event for this window
84 virtual void menu_highlighted(const ::VclMenuEvent *pEvent);
86 // toolbox items are widgets in gtk+ and Cocoa
87 virtual void notify_toolbox_item_focus(ToolBox *pToolBox);
89 // toolbox item opened a floating window (e.g. color chooser)
90 virtual void toolbox_open_floater(Window *pWindow);
92 // callback function for Application::addEventListener
93 static long WindowEventHandler(AquaA11yFocusTracker *pFocusTracker, ::VclSimpleEvent const *pEvent);
95 private:
96 // the accessible object that has the keyboard focus (if any)
97 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xFocusedObject;
99 // the listener for focus events
100 rtl::Reference< KeyboardFocusListener > m_aFocusListener;
102 // the list of Windows that need deeper (focus) investigation
103 std::set< Window *> m_aDocumentWindowList;
105 // the link object needed for Application::addEventListener
106 Link m_aWindowEventLink;
108 // the UNO XAccessibilityEventListener for Documents and other non VCL objects
109 const ::com::sun::star::uno::Reference< DocumentFocusListener > m_xDocumentFocusListener;
112 #endif // _AQUA11YFOCUSTRACKER_HXX_