1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include <sal/config.h>
24 #include <string_view>
28 #include <gtk/gtk-a11y.h>
29 #include <com/sun/star/accessibility/XAccessible.hpp>
33 namespace com::sun::star::accessibility
{
34 class XAccessibleAction
;
35 class XAccessibleComponent
;
36 class XAccessibleEditableText
;
37 class XAccessibleHypertext
;
38 class XAccessibleImage
;
39 class XAccessibleMultiLineText
;
40 class XAccessibleSelection
;
41 class XAccessibleTable
;
42 class XAccessibleTableSelection
;
43 class XAccessibleText
;
44 class XAccessibleTextMarkup
;
45 class XAccessibleTextAttributes
;
46 class XAccessibleValue
;
49 struct AtkObjectWrapper
51 GtkWidgetAccessible aParent
;
53 AtkObject
* mpOrig
; //if we're a GtkDrawingArea acting as a custom LibreOffice widget, this is the toolkit default impl
54 AtkObject
* mpSysObjChild
; //if we're a container for a sysobj, then this is the sysobj native gtk AtkObject
56 css::uno::Reference
<css::accessibility::XAccessible
> mpAccessible
;
57 css::uno::Reference
<css::accessibility::XAccessibleContext
> mpContext
;
58 css::uno::Reference
<css::accessibility::XAccessibleAction
> mpAction
;
59 css::uno::Reference
<css::accessibility::XAccessibleComponent
> mpComponent
;
60 css::uno::Reference
<css::accessibility::XAccessibleEditableText
>
62 css::uno::Reference
<css::accessibility::XAccessibleHypertext
> mpHypertext
;
63 css::uno::Reference
<css::accessibility::XAccessibleImage
> mpImage
;
64 css::uno::Reference
<css::accessibility::XAccessibleMultiLineText
>
66 css::uno::Reference
<css::accessibility::XAccessibleSelection
> mpSelection
;
67 css::uno::Reference
<css::accessibility::XAccessibleTable
> mpTable
;
68 css::uno::Reference
<css::accessibility::XAccessibleTableSelection
> mpTableSelection
;
69 css::uno::Reference
<css::accessibility::XAccessibleText
> mpText
;
70 css::uno::Reference
<css::accessibility::XAccessibleTextMarkup
> mpTextMarkup
;
71 css::uno::Reference
<css::accessibility::XAccessibleTextAttributes
>
73 css::uno::Reference
<css::accessibility::XAccessibleValue
> mpValue
;
75 AtkObject
*child_about_to_be_removed
;
76 gint index_of_child_about_to_be_removed
;
77 // OString * m_pKeyBindings
80 struct AtkObjectWrapperClass
82 GtkWidgetAccessibleClass aParentClass
;
85 GType
atk_object_wrapper_get_type() G_GNUC_CONST
;
86 AtkObject
* atk_object_wrapper_ref(
87 const css::uno::Reference
< css::accessibility::XAccessible
>& rxAccessible
,
90 AtkObject
* atk_object_wrapper_new(
91 const css::uno::Reference
< css::accessibility::XAccessible
>& rxAccessible
,
92 AtkObject
* parent
= nullptr, AtkObject
* orig
= nullptr );
94 void atk_object_wrapper_add_child(AtkObjectWrapper
* wrapper
, AtkObject
*child
, gint index
);
95 void atk_object_wrapper_remove_child(AtkObjectWrapper
* wrapper
, AtkObject
*child
, gint index
);
96 void atk_object_wrapper_set_role(AtkObjectWrapper
* wrapper
, sal_Int16 role
, sal_Int64 nStates
);
98 void atk_object_wrapper_dispose(AtkObjectWrapper
* wrapper
);
100 AtkStateType
mapAtkState( sal_Int64 nState
);
102 AtkRelation
* atk_object_wrapper_relation_new(const css::accessibility::AccessibleRelation
& rRelation
);
104 void actionIfaceInit(gpointer iface_
, gpointer
);
105 void componentIfaceInit(gpointer iface_
, gpointer
);
106 void editableTextIfaceInit(gpointer iface_
, gpointer
);
107 void hypertextIfaceInit(gpointer iface_
, gpointer
);
108 void imageIfaceInit(gpointer iface_
, gpointer
);
109 void selectionIfaceInit(gpointer iface_
, gpointer
);
110 void tableIfaceInit(gpointer iface_
, gpointer
);
111 void tablecellIfaceInit(gpointer iface_
, gpointer
);
112 void textIfaceInit(gpointer iface_
, gpointer
);
113 void valueIfaceInit(gpointer iface_
, gpointer
);
117 #define ATK_TYPE_OBJECT_WRAPPER atk_object_wrapper_get_type()
118 #define ATK_OBJECT_WRAPPER(obj) \
119 (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_OBJECT_WRAPPER, AtkObjectWrapper))
120 #define ATK_IS_OBJECT_WRAPPER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATK_TYPE_OBJECT_WRAPPER))
122 static inline gchar
*
123 OUStringToGChar(std::u16string_view rString
)
125 OString aUtf8
= OUStringToOString( rString
, RTL_TEXTENCODING_UTF8
);
126 return g_strdup( aUtf8
.getStr() );
129 #define OUStringToConstGChar( string ) OUStringToOString( string, RTL_TEXTENCODING_UTF8 ).getStr()
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */