Debian Codegraph @

vcl/unx/gtk3/a11y/atkwrapper.hxx

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20 #pragma once
21
22 #include <sal/config.h>
23
24 #include <string_view>
25
26 #include <atk/atk.h>
27 #include <gtk/gtk.h>
28 #include <gtk/gtk-a11y.h>
29 #include <com/sun/star/accessibility/XAccessible.hpp>
30
31 extern "C" {
32
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;
47 }
48
49 struct AtkObjectWrapper
50 {
51 GtkWidgetAccessible aParent;
52
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
55
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>
61 mpEditableText;
62 css::uno::Reference<css::accessibility::XAccessibleHypertext> mpHypertext;
63 css::uno::Reference<css::accessibility::XAccessibleImage> mpImage;
64 css::uno::Reference<css::accessibility::XAccessibleMultiLineText>
65 mpMultiLineText;
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>
72 mpTextAttributes;
73 css::uno::Reference<css::accessibility::XAccessibleValue> mpValue;
74
75 // OString * m_pKeyBindings
76 };
77
78 struct AtkObjectWrapperClass
79 {
80 GtkWidgetAccessibleClass aParentClass;
81 };
82
83 GType atk_object_wrapper_get_type() G_GNUC_CONST;
84 AtkObject * atk_object_wrapper_ref(
85 const css::uno::Reference< css::accessibility::XAccessible >& rxAccessible,
86 bool create = true );
87
88 AtkObject * atk_object_wrapper_new(
89 const css::uno::Reference< css::accessibility::XAccessible >& rxAccessible,
90 AtkObject* parent = nullptr, AtkObject* orig = nullptr );
91
92 void atk_object_wrapper_add_child(AtkObjectWrapper* wrapper, AtkObject *child, gint index);
93 void atk_object_wrapper_remove_child(AtkObjectWrapper* wrapper, AtkObject *child, gint index);
94 void atk_object_wrapper_set_role(AtkObjectWrapper* wrapper, sal_Int16 role, sal_Int64 nStates);
95
96 void atk_object_wrapper_dispose(AtkObjectWrapper* wrapper);
97
98 AtkStateType mapAtkState( sal_Int64 nState );
99
100 AtkRelation* atk_object_wrapper_relation_new(const css::accessibility::AccessibleRelation& rRelation);
101
102 void actionIfaceInit(gpointer iface_, gpointer);
103 void componentIfaceInit(gpointer iface_, gpointer);
104 void editableTextIfaceInit(gpointer iface_, gpointer);
105 void hypertextIfaceInit(gpointer iface_, gpointer);
106 void imageIfaceInit(gpointer iface_, gpointer);
107 void selectionIfaceInit(gpointer iface_, gpointer);
108 void tableIfaceInit(gpointer iface_, gpointer);
109 void tablecellIfaceInit(gpointer iface_, gpointer);
110 void textIfaceInit(gpointer iface_, gpointer);
111 void valueIfaceInit(gpointer iface_, gpointer);
112
113 } // extern "C"
114
115 #define ATK_TYPE_OBJECT_WRAPPER atk_object_wrapper_get_type()
116 #define ATK_OBJECT_WRAPPER(obj) \
117 (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_OBJECT_WRAPPER, AtkObjectWrapper))
118 #define ATK_IS_OBJECT_WRAPPER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATK_TYPE_OBJECT_WRAPPER))
119
120 static inline gchar *
121 OUStringToGChar(std::u16string_view rString )
122 {
123 OString aUtf8 = OUStringToOString( rString, RTL_TEXTENCODING_UTF8 );
124 return g_strdup( aUtf8.getStr() );
125 }
126
127 #define OUStringToConstGChar( string ) OUStringToOString( string, RTL_TEXTENCODING_UTF8 ).getStr()
128
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */