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