1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: atkutil.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_vcl.hxx"
34 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
35 #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
36 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
37 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
38 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
39 // --> OD 2009-04-14 #i93269#
40 #include <com/sun/star/accessibility/XAccessibleText.hpp>
42 #include <cppuhelper/implbase1.hxx>
43 #include <vos/mutex.hxx>
44 #include <rtl/ref.hxx>
46 #include <vcl/svapp.hxx>
47 #include <vcl/window.hxx>
48 #include <vcl/menu.hxx>
49 #include <vcl/toolbox.hxx>
51 #include "atkwrapper.hxx"
52 #include "atkutil.hxx"
58 // #define ENABLE_TRACING
64 using namespace ::com::sun::star
;
66 static uno::WeakReference
< accessibility::XAccessible
> xNextFocusObject
;
67 static guint focus_notify_handler
= 0;
69 /*****************************************************************************/
74 atk_wrapper_focus_idle_handler (gpointer data
)
76 vos::OGuard
aGuard( Application::GetSolarMutex() );
78 focus_notify_handler
= 0;
80 uno::Reference
< accessibility::XAccessible
> xAccessible
= xNextFocusObject
;
81 if( xAccessible
.get() == reinterpret_cast < accessibility::XAccessible
* > (data
) )
83 // Gail does not notify focus changes to NULL, so do we ..
84 if( xAccessible
.is() )
86 AtkObject
*atk_obj
= atk_object_wrapper_ref( xAccessible
);
89 fprintf(stderr
, "notifying focus event for %p\n", atk_obj
);
91 atk_focus_tracker_notify(atk_obj
);
92 // --> OD 2009-04-14 #i93269#
93 // emit text_caret_moved event for <XAccessibleText> object,
94 // if cursor is inside the <XAccessibleText> object.
95 // also emit state-changed:focused event under the same condition.
97 AtkObjectWrapper
* wrapper_obj
= ATK_OBJECT_WRAPPER (atk_obj
);
98 if( !wrapper_obj
->mpText
&& wrapper_obj
->mpContext
)
100 uno::Any any
= wrapper_obj
->mpContext
->queryInterface( accessibility::XAccessibleText::static_type(NULL
) );
101 if ( typelib_TypeClass_INTERFACE
== any
.pType
->eTypeClass
&&
104 wrapper_obj
->mpText
= reinterpret_cast< accessibility::XAccessibleText
* > (any
.pReserved
);
105 if ( wrapper_obj
->mpText
!= 0 )
107 wrapper_obj
->mpText
->acquire();
108 gint caretPos
= wrapper_obj
->mpText
->getCaretPosition();
110 if ( caretPos
!= -1 )
112 atk_object_notify_state_change( atk_obj
, ATK_STATE_FOCUSED
, TRUE
);
113 g_signal_emit_by_name( atk_obj
, "text_caret_moved", caretPos
);
120 g_object_unref(atk_obj
);
129 /*****************************************************************************/
132 atk_wrapper_focus_tracker_notify_when_idle( const uno::Reference
< accessibility::XAccessible
> &xAccessible
)
134 if( focus_notify_handler
)
135 g_source_remove(focus_notify_handler
);
137 xNextFocusObject
= xAccessible
;
139 focus_notify_handler
= g_idle_add (atk_wrapper_focus_idle_handler
, xAccessible
.get());
142 /*****************************************************************************/
144 class DocumentFocusListener
:
145 public ::cppu::WeakImplHelper1
< accessibility::XAccessibleEventListener
>
148 std::set
< uno::Reference
< uno::XInterface
> > m_aRefList
;
151 void attachRecursive(
152 const uno::Reference
< accessibility::XAccessible
>& xAccessible
153 ) throw (lang::IndexOutOfBoundsException
, uno::RuntimeException
);
155 void attachRecursive(
156 const uno::Reference
< accessibility::XAccessible
>& xAccessible
,
157 const uno::Reference
< accessibility::XAccessibleContext
>& xContext
158 ) throw (lang::IndexOutOfBoundsException
, uno::RuntimeException
);
160 void attachRecursive(
161 const uno::Reference
< accessibility::XAccessible
>& xAccessible
,
162 const uno::Reference
< accessibility::XAccessibleContext
>& xContext
,
163 const uno::Reference
< accessibility::XAccessibleStateSet
>& xStateSet
164 ) throw (lang::IndexOutOfBoundsException
, uno::RuntimeException
);
166 void detachRecursive(
167 const uno::Reference
< accessibility::XAccessible
>& xAccessible
168 ) throw (lang::IndexOutOfBoundsException
, uno::RuntimeException
);
170 void detachRecursive(
171 const uno::Reference
< accessibility::XAccessible
>& xAccessible
,
172 const uno::Reference
< accessibility::XAccessibleContext
>& xContext
173 ) throw (lang::IndexOutOfBoundsException
, uno::RuntimeException
);
175 void detachRecursive(
176 const uno::Reference
< accessibility::XAccessible
>& xAccessible
,
177 const uno::Reference
< accessibility::XAccessibleContext
>& xContext
,
178 const uno::Reference
< accessibility::XAccessibleStateSet
>& xStateSet
179 ) throw (lang::IndexOutOfBoundsException
, uno::RuntimeException
);
181 static uno::Reference
< accessibility::XAccessible
> getAccessible(const lang::EventObject
& aEvent
)
182 throw (lang::IndexOutOfBoundsException
, uno::RuntimeException
);
185 virtual void disposing( const lang::EventObject
& Source
) throw (uno::RuntimeException
);
187 // XAccessibleEventListener
188 virtual void notifyEvent( const accessibility::AccessibleEventObject
& aEvent
) throw( uno::RuntimeException
);
191 /*****************************************************************************/
193 void DocumentFocusListener::disposing( const lang::EventObject
& aEvent
)
194 throw (uno::RuntimeException
)
196 // fprintf(stderr, "In DocumentFocusListener::disposing (%p)\n", this);
197 // fprintf(stderr, "m_aRefList has %d entries\n", m_aRefList.size());
199 // Unref the object here, but do not remove as listener since the object
200 // might no longer be in a state that safely allows this.
201 if( aEvent
.Source
.is() )
202 m_aRefList
.erase(aEvent
.Source
);
204 // fprintf(stderr, "m_aRefList has %d entries\n", m_aRefList.size());
208 /*****************************************************************************/
210 void DocumentFocusListener::notifyEvent( const accessibility::AccessibleEventObject
& aEvent
)
211 throw( uno::RuntimeException
)
213 switch( aEvent
.EventId
)
215 case accessibility::AccessibleEventId::STATE_CHANGED
:
218 sal_Int16 nState
= accessibility::AccessibleStateType::INVALID
;
219 aEvent
.NewValue
>>= nState
;
221 if( accessibility::AccessibleStateType::FOCUSED
== nState
)
222 atk_wrapper_focus_tracker_notify_when_idle( getAccessible(aEvent
) );
224 catch(lang::IndexOutOfBoundsException e
)
226 g_warning("Focused object has invalid index in parent");
230 case accessibility::AccessibleEventId::CHILD
:
232 uno::Reference
< accessibility::XAccessible
> xChild
;
233 if( (aEvent
.OldValue
>>= xChild
) && xChild
.is() )
234 detachRecursive(xChild
);
236 if( (aEvent
.NewValue
>>= xChild
) && xChild
.is() )
237 attachRecursive(xChild
);
241 case accessibility::AccessibleEventId::INVALIDATE_ALL_CHILDREN
:
243 uno::Reference< accessibility::XAccessible > xAccessible( getAccessible(aEvent) );
244 detachRecursive(xAccessible);
245 attachRecursive(xAccessible);
248 g_warning( "Invalidate all children called\n" );
255 /*****************************************************************************/
257 uno::Reference
< accessibility::XAccessible
> DocumentFocusListener::getAccessible(const lang::EventObject
& aEvent
)
258 throw (lang::IndexOutOfBoundsException
, uno::RuntimeException
)
260 uno::Reference
< accessibility::XAccessible
> xAccessible(aEvent
.Source
, uno::UNO_QUERY
);
262 if( xAccessible
.is() )
265 uno::Reference
< accessibility::XAccessibleContext
> xContext(aEvent
.Source
, uno::UNO_QUERY
);
269 uno::Reference
< accessibility::XAccessible
> xParent( xContext
->getAccessibleParent() );
272 uno::Reference
< accessibility::XAccessibleContext
> xParentContext( xParent
->getAccessibleContext() );
273 if( xParentContext
.is() )
275 return xParentContext
->getAccessibleChild( xContext
->getAccessibleIndexInParent() );
280 return uno::Reference
< accessibility::XAccessible
>();
283 /*****************************************************************************/
285 void DocumentFocusListener::attachRecursive(
286 const uno::Reference
< accessibility::XAccessible
>& xAccessible
287 ) throw (lang::IndexOutOfBoundsException
, uno::RuntimeException
)
289 uno::Reference
< accessibility::XAccessibleContext
> xContext
=
290 xAccessible
->getAccessibleContext();
293 attachRecursive(xAccessible
, xContext
);
296 /*****************************************************************************/
298 void DocumentFocusListener::attachRecursive(
299 const uno::Reference
< accessibility::XAccessible
>& xAccessible
,
300 const uno::Reference
< accessibility::XAccessibleContext
>& xContext
301 ) throw (lang::IndexOutOfBoundsException
, uno::RuntimeException
)
303 uno::Reference
< accessibility::XAccessibleStateSet
> xStateSet
=
304 xContext
->getAccessibleStateSet();
307 attachRecursive(xAccessible
, xContext
, xStateSet
);
310 /*****************************************************************************/
312 void DocumentFocusListener::attachRecursive(
313 const uno::Reference
< accessibility::XAccessible
>& xAccessible
,
314 const uno::Reference
< accessibility::XAccessibleContext
>& xContext
,
315 const uno::Reference
< accessibility::XAccessibleStateSet
>& xStateSet
316 ) throw (lang::IndexOutOfBoundsException
, uno::RuntimeException
)
318 if( xStateSet
->contains(accessibility::AccessibleStateType::FOCUSED
) )
319 atk_wrapper_focus_tracker_notify_when_idle( xAccessible
);
321 uno::Reference
< accessibility::XAccessibleEventBroadcaster
> xBroadcaster
=
322 uno::Reference
< accessibility::XAccessibleEventBroadcaster
>(xContext
, uno::UNO_QUERY
);
324 // If not already done, add the broadcaster to the list and attach as listener.
325 if( xBroadcaster
.is() && m_aRefList
.insert(xBroadcaster
).second
)
327 xBroadcaster
->addEventListener(static_cast< accessibility::XAccessibleEventListener
*>(this));
329 if( ! xStateSet
->contains(accessibility::AccessibleStateType::MANAGES_DESCENDANTS
) )
331 sal_Int32 n
, nmax
= xContext
->getAccessibleChildCount();
332 for( n
= 0; n
< nmax
; n
++ )
334 uno::Reference
< accessibility::XAccessible
> xChild( xContext
->getAccessibleChild( n
) );
337 attachRecursive(xChild
);
343 /*****************************************************************************/
345 void DocumentFocusListener::detachRecursive(
346 const uno::Reference
< accessibility::XAccessible
>& xAccessible
347 ) throw (lang::IndexOutOfBoundsException
, uno::RuntimeException
)
349 uno::Reference
< accessibility::XAccessibleContext
> xContext
=
350 xAccessible
->getAccessibleContext();
353 detachRecursive(xAccessible
, xContext
);
356 /*****************************************************************************/
358 void DocumentFocusListener::detachRecursive(
359 const uno::Reference
< accessibility::XAccessible
>& xAccessible
,
360 const uno::Reference
< accessibility::XAccessibleContext
>& xContext
361 ) throw (lang::IndexOutOfBoundsException
, uno::RuntimeException
)
363 uno::Reference
< accessibility::XAccessibleStateSet
> xStateSet
=
364 xContext
->getAccessibleStateSet();
367 detachRecursive(xAccessible
, xContext
, xStateSet
);
370 /*****************************************************************************/
372 void DocumentFocusListener::detachRecursive(
373 const uno::Reference
< accessibility::XAccessible
>&,
374 const uno::Reference
< accessibility::XAccessibleContext
>& xContext
,
375 const uno::Reference
< accessibility::XAccessibleStateSet
>& xStateSet
376 ) throw (lang::IndexOutOfBoundsException
, uno::RuntimeException
)
378 uno::Reference
< accessibility::XAccessibleEventBroadcaster
> xBroadcaster
=
379 uno::Reference
< accessibility::XAccessibleEventBroadcaster
>(xContext
, uno::UNO_QUERY
);
381 if( xBroadcaster
.is() && 0 < m_aRefList
.erase(xBroadcaster
) )
383 xBroadcaster
->removeEventListener(static_cast< accessibility::XAccessibleEventListener
*>(this));
385 if( ! xStateSet
->contains(accessibility::AccessibleStateType::MANAGES_DESCENDANTS
) )
387 sal_Int32 n
, nmax
= xContext
->getAccessibleChildCount();
388 for( n
= 0; n
< nmax
; n
++ )
390 uno::Reference
< accessibility::XAccessible
> xChild( xContext
->getAccessibleChild( n
) );
393 detachRecursive(xChild
);
399 /*****************************************************************************/
402 * page tabs in gtk are widgets, so we need to simulate focus events for those
405 static void handle_tabpage_activated(Window
*pWindow
)
407 uno::Reference
< accessibility::XAccessible
> xAccessible
=
408 pWindow
->GetAccessible();
410 if( ! xAccessible
.is() )
413 uno::Reference
< accessibility::XAccessibleSelection
> xSelection(
414 xAccessible
->getAccessibleContext(), uno::UNO_QUERY
);
416 if( xSelection
.is() )
417 atk_wrapper_focus_tracker_notify_when_idle( xSelection
->getSelectedAccessibleChild(0) );
420 /*****************************************************************************/
423 * toolbar items in gtk are widgets, so we need to simulate focus events for those
426 static void notify_toolbox_item_focus(ToolBox
*pToolBox
)
428 uno::Reference
< accessibility::XAccessible
> xAccessible
=
429 pToolBox
->GetAccessible();
431 if( ! xAccessible
.is() )
434 uno::Reference
< accessibility::XAccessibleContext
> xContext
=
435 xAccessible
->getAccessibleContext();
437 if( ! xContext
.is() )
440 sal_Int32 nPos
= pToolBox
->GetItemPos( pToolBox
->GetHighlightItemId() );
441 if( nPos
!= TOOLBOX_ITEM_NOTFOUND
)
442 atk_wrapper_focus_tracker_notify_when_idle( xContext
->getAccessibleChild( nPos
) );
445 static void handle_toolbox_highlight(Window
*pWindow
)
447 ToolBox
*pToolBox
= static_cast <ToolBox
*> (pWindow
);
449 // Make sure either the toolbox or its parent toolbox has the focus
450 if ( ! pToolBox
->HasFocus() )
452 ToolBox
* pToolBoxParent
= dynamic_cast< ToolBox
* >( pToolBox
->GetParent() );
453 if ( ! pToolBoxParent
|| ! pToolBoxParent
->HasFocus() )
457 notify_toolbox_item_focus(pToolBox
);
460 static void handle_toolbox_highlightoff(Window
*pWindow
)
462 ToolBox
*pToolBox
= static_cast <ToolBox
*> (pWindow
);
463 ToolBox
* pToolBoxParent
= dynamic_cast< ToolBox
* >( pToolBox
->GetParent() );
465 // Notify when leaving sub toolboxes
466 if( pToolBoxParent
&& pToolBoxParent
->HasFocus() )
467 notify_toolbox_item_focus( pToolBoxParent
);
470 /*****************************************************************************/
472 static void create_wrapper_for_child(
473 const uno::Reference
< accessibility::XAccessibleContext
>& xContext
,
478 uno::Reference
< accessibility::XAccessible
> xChild(xContext
->getAccessibleChild(index
));
481 // create the wrapper object - it will survive the unref unless it is a transient object
482 g_object_unref( atk_object_wrapper_ref( xChild
) );
487 /*****************************************************************************/
489 static void handle_toolbox_buttonchange(VclWindowEvent
const *pEvent
)
491 Window
* pWindow
= pEvent
->GetWindow();
492 sal_Int32 index
= (sal_Int32
)(sal_IntPtr
) pEvent
->GetData();
494 if( pWindow
&& pWindow
->IsReallyVisible() )
496 uno::Reference
< accessibility::XAccessible
> xAccessible(pWindow
->GetAccessible());
497 if( xAccessible
.is() )
499 create_wrapper_for_child(xAccessible
->getAccessibleContext(), index
);
504 /*****************************************************************************/
506 static void create_wrapper_for_children(Window
*pWindow
)
508 if( pWindow
&& pWindow
->IsReallyVisible() )
510 uno::Reference
< accessibility::XAccessible
> xAccessible(pWindow
->GetAccessible());
511 if( xAccessible
.is() )
513 uno::Reference
< accessibility::XAccessibleContext
> xContext(xAccessible
->getAccessibleContext());
516 sal_Int32 nChildren
= xContext
->getAccessibleChildCount();
517 for( sal_Int32 i
= 0; i
< nChildren
; ++i
)
518 create_wrapper_for_child(xContext
, i
);
524 /*****************************************************************************/
526 static std::set
< Window
* > g_aWindowList
;
528 static void handle_get_focus(::VclWindowEvent
const * pEvent
)
530 static rtl::Reference
< DocumentFocusListener
> aDocumentFocusListener
=
531 new DocumentFocusListener();
533 Window
*pWindow
= pEvent
->GetWindow();
535 // The menu bar is handled through VCLEVENT_MENU_HIGHLIGHTED
536 if( ! pWindow
|| !pWindow
->IsReallyVisible() || pWindow
->GetType() == WINDOW_MENUBARWINDOW
)
539 // ToolBoxes are handled through VCLEVENT_TOOLBOX_HIGHLIGHT
540 if( pWindow
->GetType() == WINDOW_TOOLBOX
)
543 if( pWindow
->GetType() == WINDOW_TABCONTROL
)
545 handle_tabpage_activated( pWindow
);
549 uno::Reference
< accessibility::XAccessible
> xAccessible
=
550 pWindow
->GetAccessible();
552 if( ! xAccessible
.is() )
555 uno::Reference
< accessibility::XAccessibleContext
> xContext
=
556 xAccessible
->getAccessibleContext();
558 if( ! xContext
.is() )
561 uno::Reference
< accessibility::XAccessibleStateSet
> xStateSet
=
562 xContext
->getAccessibleStateSet();
564 if( ! xStateSet
.is() )
567 /* the UNO ToolBox wrapper does not (yet?) support XAccessibleSelection, so we
568 * need to add listeners to the children instead of re-using the tabpage stuff
570 if( xStateSet
->contains(accessibility::AccessibleStateType::FOCUSED
) &&
571 ( pWindow
->GetType() != WINDOW_TREELISTBOX
) )
573 atk_wrapper_focus_tracker_notify_when_idle( xAccessible
);
577 if( g_aWindowList
.find(pWindow
) == g_aWindowList
.end() )
579 g_aWindowList
.insert(pWindow
);
580 aDocumentFocusListener
->attachRecursive(xAccessible
, xContext
, xStateSet
);
582 #ifdef ENABLE_TRACING
584 fprintf(stderr
, "Window %p already in the list\n", pWindow
);
589 /*****************************************************************************/
591 static void handle_menu_highlighted(::VclMenuEvent
const * pEvent
)
595 Menu
* pMenu
= pEvent
->GetMenu();
596 USHORT nPos
= pEvent
->GetItemPos();
598 if( pMenu
&& nPos
!= 0xFFFF)
600 uno::Reference
< accessibility::XAccessible
> xAccessible ( pMenu
->GetAccessible() );
602 if( xAccessible
.is() )
604 uno::Reference
< accessibility::XAccessibleContext
> xContext ( xAccessible
->getAccessibleContext() );
607 atk_wrapper_focus_tracker_notify_when_idle( xContext
->getAccessibleChild( nPos
) );
611 catch( uno::Exception e
)
613 g_warning( "Exception caught processing menu highlight events" );
617 /*****************************************************************************/
619 long WindowEventHandler(void *, ::VclSimpleEvent
const * pEvent
)
622 switch (pEvent
->GetId())
624 case VCLEVENT_WINDOW_SHOW
:
625 // fprintf(stderr, "got VCLEVENT_WINDOW_SHOW for %p\n",
626 // static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow());
628 case VCLEVENT_WINDOW_HIDE
:
629 // fprintf(stderr, "got VCLEVENT_WINDOW_HIDE for %p\n",
630 // static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow());
632 case VCLEVENT_WINDOW_CLOSE
:
633 // fprintf(stderr, "got VCLEVENT_WINDOW_CLOSE for %p\n",
634 // static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow());
636 case VCLEVENT_WINDOW_GETFOCUS
:
637 handle_get_focus(static_cast< ::VclWindowEvent
const * >(pEvent
));
639 case VCLEVENT_WINDOW_LOSEFOCUS
:
640 // fprintf(stderr, "got VCLEVENT_WINDOW_LOSEFOCUS for %p\n",
641 // static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow());
643 case VCLEVENT_WINDOW_MINIMIZE
:
644 // fprintf(stderr, "got VCLEVENT_WINDOW_MINIMIZE for %p\n",
645 // static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow());
647 case VCLEVENT_WINDOW_NORMALIZE
:
648 // fprintf(stderr, "got VCLEVENT_WINDOW_NORMALIZE for %p\n",
649 // static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow());
651 case VCLEVENT_WINDOW_KEYINPUT
:
652 case VCLEVENT_WINDOW_KEYUP
:
653 case VCLEVENT_WINDOW_COMMAND
:
654 case VCLEVENT_WINDOW_MOUSEMOVE
:
657 fprintf(stderr, "got VCLEVENT_WINDOW_COMMAND (%d) for %p\n",
658 static_cast< ::CommandEvent const * > (
659 static_cast< ::VclWindowEvent const * >(pEvent)->GetData())->GetCommand(),
660 static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow());
662 case VCLEVENT_MENU_HIGHLIGHT
:
663 if (const VclMenuEvent
* pMenuEvent
= dynamic_cast<const VclMenuEvent
*>(pEvent
))
665 handle_menu_highlighted(pMenuEvent
);
667 else if (const VclAccessibleEvent
* pAccEvent
= dynamic_cast<const VclAccessibleEvent
*>(pEvent
))
669 uno::Reference
< accessibility::XAccessible
> xAccessible
= pAccEvent
->GetAccessible();
670 if (xAccessible
.is())
671 atk_wrapper_focus_tracker_notify_when_idle(xAccessible
);
675 case VCLEVENT_TOOLBOX_HIGHLIGHT
:
676 handle_toolbox_highlight(static_cast< ::VclWindowEvent
const * >(pEvent
)->GetWindow());
679 case VCLEVENT_TOOLBOX_BUTTONSTATECHANGED
:
680 handle_toolbox_buttonchange(static_cast< ::VclWindowEvent
const * >(pEvent
));
683 case VCLEVENT_OBJECT_DYING
:
684 g_aWindowList
.erase( static_cast< ::VclWindowEvent
const * >(pEvent
)->GetWindow() );
685 // fallthrough intentional !
686 case VCLEVENT_TOOLBOX_HIGHLIGHTOFF
:
687 handle_toolbox_highlightoff(static_cast< ::VclWindowEvent
const * >(pEvent
)->GetWindow());
690 case VCLEVENT_TABPAGE_ACTIVATE
:
691 handle_tabpage_activated(static_cast< ::VclWindowEvent
const * >(pEvent
)->GetWindow());
694 case VCLEVENT_COMBOBOX_SETTEXT
:
695 create_wrapper_for_children(static_cast< ::VclWindowEvent
const * >(pEvent
)->GetWindow());
699 // OSL_TRACE("got event %d \n", pEvent->GetId());
702 } catch(lang::IndexOutOfBoundsException e
)
704 g_warning("Focused object has invalid index in parent");
709 static Link
g_aEventListenerLink( NULL
, (PSTUB
) WindowEventHandler
);
711 /*****************************************************************************/
715 static G_CONST_RETURN gchar
*
716 ooo_atk_util_get_toolkit_name (void)
721 /*****************************************************************************/
723 static G_CONST_RETURN gchar
*
724 ooo_atk_util_get_toolkit_version (void)
727 * Version is passed in as a -D flag when this file is
734 /*****************************************************************************/
737 * GObject inheritance
741 ooo_atk_util_class_init (AtkUtilClass
*)
743 AtkUtilClass
*atk_class
;
746 data
= g_type_class_peek (ATK_TYPE_UTIL
);
747 atk_class
= ATK_UTIL_CLASS (data
);
749 atk_class
->get_toolkit_name
= ooo_atk_util_get_toolkit_name
;
750 atk_class
->get_toolkit_version
= ooo_atk_util_get_toolkit_version
;
752 Application::AddEventListener( g_aEventListenerLink
);
757 /*****************************************************************************/
760 ooo_atk_util_get_type (void)
762 static GType type
= 0;
766 GType parent_type
= g_type_from_name( "GailUtil" );
770 g_warning( "Unknown type: GailUtil" );
771 parent_type
= ATK_TYPE_UTIL
;
774 GTypeQuery type_query
;
775 g_type_query( parent_type
, &type_query
);
777 static const GTypeInfo typeInfo
=
779 type_query
.class_size
,
780 (GBaseInitFunc
) NULL
,
781 (GBaseFinalizeFunc
) NULL
,
782 (GClassInitFunc
) ooo_atk_util_class_init
,
783 (GClassFinalizeFunc
) NULL
,
785 type_query
.instance_size
,
787 (GInstanceInitFunc
) NULL
,
791 type
= g_type_register_static (parent_type
, "OOoUtil", &typeInfo
, (GTypeFlags
)0) ;