xref: /AOO41X/main/vcl/inc/aqua/aqua11yfocustracker.hxx (revision ebfcd9af2ce496a86a62eef7379364d0a42a7f96)
1*ebfcd9afSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*ebfcd9afSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*ebfcd9afSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*ebfcd9afSAndrew Rist  * distributed with this work for additional information
6*ebfcd9afSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*ebfcd9afSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*ebfcd9afSAndrew Rist  * "License"); you may not use this file except in compliance
9*ebfcd9afSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*ebfcd9afSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*ebfcd9afSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*ebfcd9afSAndrew Rist  * software distributed under the License is distributed on an
15*ebfcd9afSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*ebfcd9afSAndrew Rist  * KIND, either express or implied.  See the License for the
17*ebfcd9afSAndrew Rist  * specific language governing permissions and limitations
18*ebfcd9afSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*ebfcd9afSAndrew Rist  *************************************************************/
21*ebfcd9afSAndrew Rist 
22*ebfcd9afSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _AQUA11YFOCUSTRACKER_HXX_
25cdf0e10cSrcweir #define _AQUA11YFOCUSTRACKER_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_HPP_
28cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessible.hpp>
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include "keyboardfocuslistener.hxx"
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <rtl/instance.hxx>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir #include <tools/link.hxx>
36cdf0e10cSrcweir #include <vcl/vclevent.hxx>
37cdf0e10cSrcweir #include <set>
38cdf0e10cSrcweir 
39cdf0e10cSrcweir class Window;
40cdf0e10cSrcweir class ToolBox;
41cdf0e10cSrcweir class DocumentFocusListener;
42cdf0e10cSrcweir 
43cdf0e10cSrcweir // ------------------------
44cdf0e10cSrcweir // - AquaA11yFocusTracker -
45cdf0e10cSrcweir // ------------------------
46cdf0e10cSrcweir 
47cdf0e10cSrcweir class AquaA11yFocusTracker : public rtl::Static< AquaA11yFocusTracker, AquaA11yFocusTracker>
48cdf0e10cSrcweir {
49cdf0e10cSrcweir 
50cdf0e10cSrcweir public:
51cdf0e10cSrcweir     AquaA11yFocusTracker();
52cdf0e10cSrcweir 
getFocusedObject()53cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > getFocusedObject() { return m_xFocusedObject; };
54cdf0e10cSrcweir 
55cdf0e10cSrcweir     // sets the currently focus object and notifies the FocusEventListener (if any)
56cdf0e10cSrcweir     void setFocusedObject(const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& xAccessible);
57cdf0e10cSrcweir 
58cdf0e10cSrcweir 	// may evolve to add/remove later
setFocusListener(const rtl::Reference<KeyboardFocusListener> & aFocusListener)59cdf0e10cSrcweir 	void setFocusListener(const rtl::Reference< KeyboardFocusListener >& aFocusListener) { m_aFocusListener = aFocusListener; };
60cdf0e10cSrcweir 
61cdf0e10cSrcweir protected:
62cdf0e10cSrcweir 
63cdf0e10cSrcweir     // received a WINDOW_GETFOCUS event for this window
64cdf0e10cSrcweir     virtual void window_got_focus(Window *pWindow);
65cdf0e10cSrcweir 
66cdf0e10cSrcweir     // received a TOOLBOX_HIGHLIGHT event for this window
67cdf0e10cSrcweir     virtual void toolbox_highlight_on(Window *pWindow);
68cdf0e10cSrcweir 
69cdf0e10cSrcweir     // received a TOOLBOX_HIGHLIGHTOFF event for this window
70cdf0e10cSrcweir     virtual void toolbox_highlight_off(Window *pWindow);
71cdf0e10cSrcweir 
72cdf0e10cSrcweir     // received a TABPAGE_ACTIVATE event for this window
73cdf0e10cSrcweir     virtual void tabpage_activated(Window *pWindow);
74cdf0e10cSrcweir 
75cdf0e10cSrcweir     // received a MENU_HIGHLIGHT event for this window
76cdf0e10cSrcweir     virtual void menu_highlighted(const ::VclMenuEvent *pEvent);
77cdf0e10cSrcweir 
78cdf0e10cSrcweir     // toolbox items are widgets in gtk+ and Cocoa
79cdf0e10cSrcweir     virtual void notify_toolbox_item_focus(ToolBox *pToolBox);
80cdf0e10cSrcweir 
81cdf0e10cSrcweir     // toolbox item opened a floating window (e.g. color chooser)
82cdf0e10cSrcweir     virtual void toolbox_open_floater(Window *pWindow);
83cdf0e10cSrcweir 
84cdf0e10cSrcweir     // callback function for Application::addEventListener
85cdf0e10cSrcweir 	static long WindowEventHandler(AquaA11yFocusTracker *pFocusTracker, ::VclSimpleEvent const *pEvent);
86cdf0e10cSrcweir 
87cdf0e10cSrcweir private:
88cdf0e10cSrcweir     // the accessible object that has the keyboard focus (if any)
89cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xFocusedObject;
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 	// the listener for focus events
92cdf0e10cSrcweir 	rtl::Reference< KeyboardFocusListener > m_aFocusListener;
93cdf0e10cSrcweir 
94cdf0e10cSrcweir 	// the list of Windows that need deeper (focus) investigation
95cdf0e10cSrcweir 	std::set< Window *> m_aDocumentWindowList;
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 	// the link object needed for Application::addEventListener
98cdf0e10cSrcweir 	Link m_aWindowEventLink;
99cdf0e10cSrcweir 
100cdf0e10cSrcweir     // the UNO XAccessibilityEventListener for Documents and other non VCL objects
101cdf0e10cSrcweir     const ::com::sun::star::uno::Reference< DocumentFocusListener > m_xDocumentFocusListener;
102cdf0e10cSrcweir };
103cdf0e10cSrcweir 
104cdf0e10cSrcweir #endif	// _AQUA11YFOCUSTRACKER_HXX_
105