xref: /aoo4110/main/vcl/unx/gtk/a11y/atkwrapper.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef __ATK_WRAPPER_HXX__
25 #define __ATK_WRAPPER_HXX__
26 
27 #include <atk/atk.h>
28 #include <com/sun/star/accessibility/XAccessible.hpp>
29 
30 extern "C" {
31 
32 typedef struct _AtkObjectWrapper      AtkObjectWrapper;
33 typedef struct _AtkObjectWrapperClass AtkObjectWrapperClass;
34 
35 namespace com { namespace sun { namespace star { namespace accessibility {
36     class XAccessibleAction;
37     class XAccessibleComponent;
38     class XAccessibleEditableText;
39     class XAccessibleHypertext;
40     class XAccessibleImage;
41     class XAccessibleMultiLineText;
42     class XAccessibleSelection;
43     class XAccessibleTable;
44     class XAccessibleText;
45     class XAccessibleTextMarkup;
46     class XAccessibleTextAttributes;
47     class XAccessibleValue;
48 } } } }
49 
50 
51 struct _AtkObjectWrapper
52 {
53     AtkObject aParent;
54 
55     ::com::sun::star::accessibility::XAccessible               *mpAccessible;
56     ::com::sun::star::accessibility::XAccessibleContext        *mpContext;
57     ::com::sun::star::accessibility::XAccessibleAction         *mpAction;
58     ::com::sun::star::accessibility::XAccessibleComponent      *mpComponent;
59     ::com::sun::star::accessibility::XAccessibleEditableText   *mpEditableText;
60     ::com::sun::star::accessibility::XAccessibleHypertext      *mpHypertext;
61     ::com::sun::star::accessibility::XAccessibleImage          *mpImage;
62     ::com::sun::star::accessibility::XAccessibleMultiLineText  *mpMultiLineText;
63     ::com::sun::star::accessibility::XAccessibleSelection      *mpSelection;
64     ::com::sun::star::accessibility::XAccessibleTable          *mpTable;
65     ::com::sun::star::accessibility::XAccessibleText           *mpText;
66     ::com::sun::star::accessibility::XAccessibleTextMarkup     *mpTextMarkup;
67     ::com::sun::star::accessibility::XAccessibleTextAttributes *mpTextAttributes;
68     ::com::sun::star::accessibility::XAccessibleValue          *mpValue;
69 
70     AtkObject *child_about_to_be_removed;
71     gint       index_of_child_about_to_be_removed;
72 //    ::rtl::OString * m_pKeyBindings
73 };
74 
75 struct _AtkObjectWrapperClass
76 {
77     AtkObjectClass aParentClass;
78 };
79 
80 GType                  atk_object_wrapper_get_type (void) G_GNUC_CONST;
81 AtkObject *            atk_object_wrapper_ref(
82     const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxAccessible,
83     bool create = true );
84 
85 AtkObject *            atk_object_wrapper_new(
86     const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxAccessible,
87     AtkObject* parent = NULL );
88 
89 void                   atk_object_wrapper_add_child(AtkObjectWrapper* wrapper, AtkObject *child, gint index);
90 void                   atk_object_wrapper_remove_child(AtkObjectWrapper* wrapper, AtkObject *child, gint index);
91 
92 void                   atk_object_wrapper_dispose(AtkObjectWrapper* wrapper);
93 
94 AtkStateType mapAtkState( sal_Int16 nState );
95 
96 void                   actionIfaceInit(AtkActionIface *iface);
97 void                   componentIfaceInit(AtkComponentIface *iface);
98 void                   editableTextIfaceInit(AtkEditableTextIface *iface);
99 void                   hypertextIfaceInit(AtkHypertextIface *iface);
100 void                   imageIfaceInit(AtkImageIface *iface);
101 void                   selectionIfaceInit(AtkSelectionIface *iface);
102 void                   tableIfaceInit(AtkTableIface *iface);
103 void                   textIfaceInit(AtkTextIface *iface);
104 void                   valueIfaceInit(AtkValueIface *iface);
105 
106 } // extern "C"
107 
108 #define ATK_TYPE_OBJECT_WRAPPER atk_object_wrapper_get_type()
109 #define ATK_OBJECT_WRAPPER(obj) \
110     (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_OBJECT_WRAPPER, AtkObjectWrapper))
111 
112 static inline gchar *
OUStringToGChar(const rtl::OUString & rString)113 OUStringToGChar(const rtl::OUString& rString )
114 {
115     rtl::OString aUtf8 = rtl::OUStringToOString( rString, RTL_TEXTENCODING_UTF8 );
116     return g_strdup( aUtf8.getStr() );
117 }
118 
119 #define OUStringToConstGChar( string ) rtl::OUStringToOString( string, RTL_TEXTENCODING_UTF8 ).getStr()
120 
121 #endif /* __ATK_WRAPPER_HXX__ */
122