xref: /aoo41x/main/vcl/unx/gtk/a11y/atkwrapper.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef __ATK_WRAPPER_HXX__
29 #define __ATK_WRAPPER_HXX__
30 
31 #include <atk/atk.h>
32 #include <com/sun/star/accessibility/XAccessible.hpp>
33 
34 extern "C" {
35 
36 typedef struct _AtkObjectWrapper      AtkObjectWrapper;
37 typedef struct _AtkObjectWrapperClass AtkObjectWrapperClass;
38 
39 namespace com { namespace sun { namespace star { namespace accessibility {
40     class XAccessibleAction;
41     class XAccessibleComponent;
42     class XAccessibleEditableText;
43     class XAccessibleHypertext;
44     class XAccessibleImage;
45     class XAccessibleMultiLineText;
46     class XAccessibleSelection;
47     class XAccessibleTable;
48     class XAccessibleText;
49     class XAccessibleTextMarkup;
50     class XAccessibleTextAttributes;
51     class XAccessibleValue;
52 } } } }
53 
54 
55 struct _AtkObjectWrapper
56 {
57     AtkObject aParent;
58 
59     ::com::sun::star::accessibility::XAccessible               *mpAccessible;
60     ::com::sun::star::accessibility::XAccessibleContext        *mpContext;
61     ::com::sun::star::accessibility::XAccessibleAction         *mpAction;
62     ::com::sun::star::accessibility::XAccessibleComponent      *mpComponent;
63     ::com::sun::star::accessibility::XAccessibleEditableText   *mpEditableText;
64     ::com::sun::star::accessibility::XAccessibleHypertext      *mpHypertext;
65     ::com::sun::star::accessibility::XAccessibleImage          *mpImage;
66     ::com::sun::star::accessibility::XAccessibleMultiLineText  *mpMultiLineText;
67     ::com::sun::star::accessibility::XAccessibleSelection      *mpSelection;
68     ::com::sun::star::accessibility::XAccessibleTable          *mpTable;
69     ::com::sun::star::accessibility::XAccessibleText           *mpText;
70     ::com::sun::star::accessibility::XAccessibleTextMarkup     *mpTextMarkup;
71     ::com::sun::star::accessibility::XAccessibleTextAttributes *mpTextAttributes;
72     ::com::sun::star::accessibility::XAccessibleValue          *mpValue;
73 
74     AtkObject *child_about_to_be_removed;
75     gint       index_of_child_about_to_be_removed;
76 //    ::rtl::OString * m_pKeyBindings
77 };
78 
79 struct _AtkObjectWrapperClass
80 {
81     AtkObjectClass aParentClass;
82 };
83 
84 GType                  atk_object_wrapper_get_type (void) G_GNUC_CONST;
85 AtkObject *            atk_object_wrapper_ref(
86     const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxAccessible,
87     bool create = true );
88 
89 AtkObject *            atk_object_wrapper_new(
90     const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxAccessible,
91     AtkObject* parent = NULL );
92 
93 void                   atk_object_wrapper_add_child(AtkObjectWrapper* wrapper, AtkObject *child, gint index);
94 void                   atk_object_wrapper_remove_child(AtkObjectWrapper* wrapper, AtkObject *child, gint index);
95 
96 void                   atk_object_wrapper_dispose(AtkObjectWrapper* wrapper);
97 
98 AtkStateType mapAtkState( sal_Int16 nState );
99 
100 void                   actionIfaceInit(AtkActionIface *iface);
101 void                   componentIfaceInit(AtkComponentIface *iface);
102 void                   editableTextIfaceInit(AtkEditableTextIface *iface);
103 void                   hypertextIfaceInit(AtkHypertextIface *iface);
104 void                   imageIfaceInit(AtkImageIface *iface);
105 void                   selectionIfaceInit(AtkSelectionIface *iface);
106 void                   tableIfaceInit(AtkTableIface *iface);
107 void                   textIfaceInit(AtkTextIface *iface);
108 void                   valueIfaceInit(AtkValueIface *iface);
109 
110 } // extern "C"
111 
112 #define ATK_TYPE_OBJECT_WRAPPER atk_object_wrapper_get_type()
113 #define ATK_OBJECT_WRAPPER(obj) \
114     (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_OBJECT_WRAPPER, AtkObjectWrapper))
115 
116 static inline gchar *
117 OUStringToGChar(const rtl::OUString& rString )
118 {
119     rtl::OString aUtf8 = rtl::OUStringToOString( rString, RTL_TEXTENCODING_UTF8 );
120     return g_strdup( aUtf8 );
121 }
122 
123 #define OUStringToConstGChar( string ) rtl::OUStringToOString( string, RTL_TEXTENCODING_UTF8 ).getStr()
124 
125 #endif /* __ATK_WRAPPER_HXX__ */
126