1
/*
2
 * AT-SPI - Assistive Technology Service Provider Interface
3
 * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
4
 *
5
 * Copyright 2008 Novell, Inc.
6
 * Copyright 2001, 2002 Sun Microsystems Inc.,
7
 * Copyright 2001, 2002 Ximian, Inc.
8
 *
9
 * This library is free software; you can redistribute it and/or
10
 * modify it under the terms of the GNU Lesser General Public
11
 * License as published by the Free Software Foundation; either
12
 * version 2.1 of the License, or (at your option) any later version.
13
 *
14
 * This library is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17
 * Lesser General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU Lesser General Public
20
 * License along with this library; if not, write to the
21
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22
 * Boston, MA 02110-1301, USA.
23
 */
24

            
25
#define ATK_DISABLE_DEPRECATION_WARNINGS
26
#include "bridge.h"
27
#include <atk/atk.h>
28
#include <droute/droute.h>
29

            
30
#include "spi-dbus.h"
31

            
32
#include "introspection.h"
33
#include "object.h"
34

            
35
static dbus_bool_t
36
impl_get_Version (DBusMessageIter *iter, void *user_data)
37
{
38
  return droute_return_v_uint32 (iter, SPI_DBUS_TABLE_VERSION);
39
}
40

            
41
static dbus_bool_t
42
1
impl_get_NRows (DBusMessageIter *iter, void *user_data)
43
{
44
1
  AtkTable *table = (AtkTable *) user_data;
45
1
  g_return_val_if_fail (ATK_IS_TABLE (user_data), FALSE);
46
1
  return droute_return_v_int32 (iter, atk_table_get_n_rows (table));
47
}
48

            
49
static dbus_bool_t
50
1
impl_get_NColumns (DBusMessageIter *iter, void *user_data)
51
{
52
1
  AtkTable *table = (AtkTable *) user_data;
53
1
  g_return_val_if_fail (ATK_IS_TABLE (user_data), FALSE);
54
1
  return droute_return_v_int32 (iter, atk_table_get_n_columns (table));
55
}
56

            
57
static dbus_bool_t
58
1
impl_get_Caption (DBusMessageIter *iter, void *user_data)
59
{
60
1
  AtkTable *table = (AtkTable *) user_data;
61
1
  g_return_val_if_fail (ATK_IS_TABLE (user_data), FALSE);
62
1
  spi_object_append_v_reference (iter, atk_table_get_caption (table));
63
1
  return TRUE;
64
}
65

            
66
static dbus_bool_t
67
1
impl_get_Summary (DBusMessageIter *iter, void *user_data)
68
{
69
1
  AtkTable *table = (AtkTable *) user_data;
70
1
  g_return_val_if_fail (ATK_IS_TABLE (user_data), FALSE);
71
1
  spi_object_append_v_reference (iter, atk_table_get_summary (table));
72
1
  return TRUE;
73
}
74

            
75
static dbus_bool_t
76
1
impl_get_NSelectedRows (DBusMessageIter *iter, void *user_data)
77
{
78
1
  AtkTable *table = (AtkTable *) user_data;
79
1
  gint *selected_rows = NULL;
80
  int count;
81
1
  g_return_val_if_fail (ATK_IS_TABLE (user_data), FALSE);
82
1
  count = atk_table_get_selected_rows (table, &selected_rows);
83
1
  if (selected_rows)
84
1
    g_free (selected_rows);
85
1
  return droute_return_v_int32 (iter, count);
86
}
87

            
88
static dbus_bool_t
89
1
impl_get_NSelectedColumns (DBusMessageIter *iter, void *user_data)
90
{
91
1
  AtkTable *table = (AtkTable *) user_data;
92
1
  gint *selected_columns = NULL;
93
  int count;
94
1
  g_return_val_if_fail (ATK_IS_TABLE (user_data), FALSE);
95
1
  count = atk_table_get_selected_columns (table, &selected_columns);
96
1
  if (selected_columns)
97
1
    g_free (selected_columns);
98
1
  return droute_return_v_int32 (iter, count);
99
}
100

            
101
static DBusMessage *
102
2
impl_GetAccessibleAt (DBusConnection *bus, DBusMessage *message, void *user_data)
103
{
104
2
  AtkTable *table = (AtkTable *) user_data;
105
  dbus_int32_t row, column;
106
  DBusMessage *reply;
107
  AtkObject *obj;
108

            
109
2
  g_return_val_if_fail (ATK_IS_TABLE (user_data),
110
                        droute_not_yet_handled_error (message));
111
2
  if (!dbus_message_get_args (message, NULL, DBUS_TYPE_INT32, &row, DBUS_TYPE_INT32, &column,
112
                              DBUS_TYPE_INVALID))
113
    {
114
      return droute_invalid_arguments_error (message);
115
    }
116
2
  obj = atk_table_ref_at (table, row, column);
117
2
  reply = spi_object_return_reference (message, obj);
118
2
  if (obj)
119
2
    g_object_unref (obj);
120

            
121
2
  return reply;
122
}
123

            
124
static DBusMessage *
125
3
impl_GetIndexAt (DBusConnection *bus, DBusMessage *message, void *user_data)
126
{
127
3
  AtkTable *table = (AtkTable *) user_data;
128
  dbus_int32_t row, column;
129
  dbus_int32_t index;
130
  DBusMessage *reply;
131

            
132
3
  g_return_val_if_fail (ATK_IS_TABLE (user_data),
133
                        droute_not_yet_handled_error (message));
134
3
  if (!dbus_message_get_args (message, NULL, DBUS_TYPE_INT32, &row, DBUS_TYPE_INT32, &column,
135
                              DBUS_TYPE_INVALID))
136
    {
137
      return droute_invalid_arguments_error (message);
138
    }
139
3
  index = atk_table_get_index_at (table, row, column);
140
3
  reply = dbus_message_new_method_return (message);
141
3
  if (reply)
142
    {
143
3
      dbus_message_append_args (reply, DBUS_TYPE_INT32, &index,
144
                                DBUS_TYPE_INVALID);
145
    }
146
3
  return reply;
147
}
148

            
149
static DBusMessage *
150
4
impl_GetRowAtIndex (DBusConnection *bus, DBusMessage *message, void *user_data)
151
{
152
4
  AtkTable *table = (AtkTable *) user_data;
153
  dbus_int32_t index;
154
  dbus_int32_t row;
155
  DBusMessage *reply;
156

            
157
4
  g_return_val_if_fail (ATK_IS_TABLE (user_data),
158
                        droute_not_yet_handled_error (message));
159
4
  if (!dbus_message_get_args (message, NULL, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
160
    {
161
      return droute_invalid_arguments_error (message);
162
    }
163
4
  row = atk_table_get_row_at_index (table, index);
164
4
  reply = dbus_message_new_method_return (message);
165
4
  if (reply)
166
    {
167
4
      dbus_message_append_args (reply, DBUS_TYPE_INT32, &row,
168
                                DBUS_TYPE_INVALID);
169
    }
170
4
  return reply;
171
}
172

            
173
static DBusMessage *
174
3
impl_GetColumnAtIndex (DBusConnection *bus, DBusMessage *message, void *user_data)
175
{
176
3
  AtkTable *table = (AtkTable *) user_data;
177
  dbus_int32_t index;
178
  dbus_int32_t column;
179
  DBusMessage *reply;
180

            
181
3
  g_return_val_if_fail (ATK_IS_TABLE (user_data),
182
                        droute_not_yet_handled_error (message));
183
3
  if (!dbus_message_get_args (message, NULL, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
184
    {
185
      return droute_invalid_arguments_error (message);
186
    }
187
3
  column = atk_table_get_column_at_index (table, index);
188
3
  reply = dbus_message_new_method_return (message);
189
3
  if (reply)
190
    {
191
3
      dbus_message_append_args (reply, DBUS_TYPE_INT32, &column,
192
                                DBUS_TYPE_INVALID);
193
    }
194
3
  return reply;
195
}
196

            
197
static const gchar *
198
4
validate_unallocated_string (const gchar *str)
199
{
200
4
  if (!str)
201
    return "";
202
4
  if (!g_utf8_validate (str, -1, NULL))
203
    {
204
      g_warning ("atk-bridge: received bad UTF-8 string from a table function");
205
      return "";
206
    }
207
4
  return str;
208
}
209

            
210
static DBusMessage *
211
2
impl_GetRowDescription (DBusConnection *bus, DBusMessage *message, void *user_data)
212
{
213
  dbus_int32_t row;
214
2
  AtkTable *table = (AtkTable *) user_data;
215
  const gchar *description;
216
  DBusMessage *reply;
217

            
218
2
  g_return_val_if_fail (ATK_IS_TABLE (user_data),
219
                        droute_not_yet_handled_error (message));
220
2
  if (!dbus_message_get_args (message, NULL, DBUS_TYPE_INT32, &row, DBUS_TYPE_INVALID))
221
    {
222
      return droute_invalid_arguments_error (message);
223
    }
224
2
  description = atk_table_get_row_description (table, row);
225
2
  description = validate_unallocated_string (description);
226
2
  reply = dbus_message_new_method_return (message);
227
2
  if (reply)
228
    {
229
2
      dbus_message_append_args (reply, DBUS_TYPE_STRING, &description,
230
                                DBUS_TYPE_INVALID);
231
    }
232
2
  return reply;
233
}
234

            
235
static DBusMessage *
236
2
impl_GetColumnDescription (DBusConnection *bus, DBusMessage *message, void *user_data)
237
{
238
2
  AtkTable *table = (AtkTable *) user_data;
239
  dbus_int32_t column;
240
  const char *description;
241
  DBusMessage *reply;
242

            
243
2
  g_return_val_if_fail (ATK_IS_TABLE (user_data),
244
                        droute_not_yet_handled_error (message));
245
2
  if (!dbus_message_get_args (message, NULL, DBUS_TYPE_INT32, &column, DBUS_TYPE_INVALID))
246
    {
247
      return droute_invalid_arguments_error (message);
248
    }
249
2
  description = atk_table_get_column_description (table, column);
250
2
  description = validate_unallocated_string (description);
251
2
  reply = dbus_message_new_method_return (message);
252
2
  if (reply)
253
    {
254
2
      dbus_message_append_args (reply, DBUS_TYPE_STRING, &description,
255
                                DBUS_TYPE_INVALID);
256
    }
257
2
  return reply;
258
}
259

            
260
static DBusMessage *
261
1
impl_GetRowExtentAt (DBusConnection *bus, DBusMessage *message, void *user_data)
262
{
263
1
  AtkTable *table = (AtkTable *) user_data;
264
  dbus_int32_t row, column;
265
  dbus_int32_t extent;
266
  DBusMessage *reply;
267

            
268
1
  g_return_val_if_fail (ATK_IS_TABLE (user_data),
269
                        droute_not_yet_handled_error (message));
270
1
  if (!dbus_message_get_args (message, NULL, DBUS_TYPE_INT32, &row, DBUS_TYPE_INT32, &column,
271
                              DBUS_TYPE_INVALID))
272
    {
273
      return droute_invalid_arguments_error (message);
274
    }
275
1
  extent = atk_table_get_row_extent_at (table, row, column);
276
1
  reply = dbus_message_new_method_return (message);
277
1
  if (reply)
278
    {
279
1
      dbus_message_append_args (reply, DBUS_TYPE_INT32, &extent,
280
                                DBUS_TYPE_INVALID);
281
    }
282
1
  return reply;
283
}
284

            
285
static DBusMessage *
286
1
impl_GetColumnExtentAt (DBusConnection *bus, DBusMessage *message, void *user_data)
287
{
288
1
  AtkTable *table = (AtkTable *) user_data;
289
  dbus_int32_t row, column;
290
  dbus_int32_t extent;
291
  DBusMessage *reply;
292

            
293
1
  g_return_val_if_fail (ATK_IS_TABLE (user_data),
294
                        droute_not_yet_handled_error (message));
295
1
  if (!dbus_message_get_args (message, NULL, DBUS_TYPE_INT32, &row, DBUS_TYPE_INT32, &column,
296
                              DBUS_TYPE_INVALID))
297
    {
298
      return droute_invalid_arguments_error (message);
299
    }
300
1
  extent = atk_table_get_column_extent_at (table, row, column);
301
1
  reply = dbus_message_new_method_return (message);
302
1
  if (reply)
303
    {
304
1
      dbus_message_append_args (reply, DBUS_TYPE_INT32, &extent,
305
                                DBUS_TYPE_INVALID);
306
    }
307
1
  return reply;
308
}
309

            
310
static DBusMessage *
311
2
impl_GetRowHeader (DBusConnection *bus, DBusMessage *message, void *user_data)
312
{
313
2
  AtkTable *table = (AtkTable *) user_data;
314
  dbus_int32_t row;
315
2
  AtkObject *obj = NULL;
316

            
317
2
  g_return_val_if_fail (ATK_IS_TABLE (user_data),
318
                        droute_not_yet_handled_error (message));
319
2
  if (!dbus_message_get_args (message, NULL, DBUS_TYPE_INT32, &row, DBUS_TYPE_INVALID))
320
    {
321
      return droute_invalid_arguments_error (message);
322
    }
323
2
  obj = atk_table_get_row_header (table, row);
324
2
  return spi_object_return_reference (message, obj);
325
}
326

            
327
static DBusMessage *
328
3
impl_GetColumnHeader (DBusConnection *bus, DBusMessage *message, void *user_data)
329
{
330
3
  AtkTable *table = (AtkTable *) user_data;
331
  dbus_int32_t column;
332
  AtkObject *obj;
333

            
334
3
  g_return_val_if_fail (ATK_IS_TABLE (user_data),
335
                        droute_not_yet_handled_error (message));
336
3
  if (!dbus_message_get_args (message, NULL, DBUS_TYPE_INT32, &column, DBUS_TYPE_INVALID))
337
    {
338
      return droute_invalid_arguments_error (message);
339
    }
340
3
  obj = atk_table_get_column_header (table, column);
341
3
  return spi_object_return_reference (message, obj);
342
}
343

            
344
static DBusMessage *
345
1
impl_GetSelectedRows (DBusConnection *bus, DBusMessage *message, void *user_data)
346
{
347
1
  AtkTable *table = (AtkTable *) user_data;
348
1
  gint *selected_rows = NULL;
349
  gint count;
350
  DBusMessage *reply;
351

            
352
1
  g_return_val_if_fail (ATK_IS_TABLE (user_data),
353
                        droute_not_yet_handled_error (message));
354
1
  count = atk_table_get_selected_rows (table, &selected_rows);
355
1
  if (!selected_rows)
356
    count = 0;
357
1
  reply = dbus_message_new_method_return (message);
358
1
  if (reply)
359
    {
360
      /* tbd - figure out if this is safe for a 0-length array */
361
1
      dbus_message_append_args (reply, DBUS_TYPE_ARRAY, DBUS_TYPE_INT32,
362
                                &selected_rows, count, DBUS_TYPE_INVALID);
363
    }
364
1
  if (selected_rows)
365
1
    g_free (selected_rows);
366
1
  return reply;
367
}
368

            
369
static DBusMessage *
370
1
impl_GetSelectedColumns (DBusConnection *bus, DBusMessage *message, void *user_data)
371
{
372
1
  AtkTable *table = (AtkTable *) user_data;
373
1
  gint *selected_columns = NULL;
374
  gint count;
375
  DBusMessage *reply;
376

            
377
1
  g_return_val_if_fail (ATK_IS_TABLE (user_data),
378
                        droute_not_yet_handled_error (message));
379
1
  count = atk_table_get_selected_columns (table, &selected_columns);
380
1
  if (!selected_columns)
381
    count = 0;
382
1
  reply = dbus_message_new_method_return (message);
383
1
  if (reply)
384
    {
385
      /* tbd - figure out if this is safe for a 0-length array */
386
1
      dbus_message_append_args (reply, DBUS_TYPE_ARRAY, DBUS_TYPE_INT32,
387
                                &selected_columns, count, DBUS_TYPE_INVALID);
388
    }
389
1
  if (selected_columns)
390
1
    g_free (selected_columns);
391
1
  return reply;
392
}
393

            
394
static DBusMessage *
395
6
impl_IsRowSelected (DBusConnection *bus, DBusMessage *message, void *user_data)
396
{
397
6
  AtkTable *table = (AtkTable *) user_data;
398
  dbus_int32_t row;
399
  DBusMessage *reply;
400
  dbus_bool_t ret;
401

            
402
6
  g_return_val_if_fail (ATK_IS_TABLE (user_data),
403
                        droute_not_yet_handled_error (message));
404
6
  if (!dbus_message_get_args (message, NULL, DBUS_TYPE_INT32, &row, DBUS_TYPE_INVALID))
405
    {
406
      return droute_invalid_arguments_error (message);
407
    }
408
6
  ret = atk_table_is_row_selected (table, row);
409
6
  reply = dbus_message_new_method_return (message);
410
6
  if (reply)
411
    {
412
6
      dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &ret,
413
                                DBUS_TYPE_INVALID);
414
    }
415
6
  return reply;
416
}
417

            
418
static DBusMessage *
419
6
impl_IsColumnSelected (DBusConnection *bus, DBusMessage *message, void *user_data)
420
{
421
6
  AtkTable *table = (AtkTable *) user_data;
422
  dbus_int32_t column;
423
  DBusMessage *reply;
424
  dbus_bool_t ret;
425

            
426
6
  g_return_val_if_fail (ATK_IS_TABLE (user_data),
427
                        droute_not_yet_handled_error (message));
428
6
  if (!dbus_message_get_args (message, NULL, DBUS_TYPE_INT32, &column, DBUS_TYPE_INVALID))
429
    {
430
      return droute_invalid_arguments_error (message);
431
    }
432
6
  ret = atk_table_is_column_selected (table, column);
433
6
  reply = dbus_message_new_method_return (message);
434
6
  if (reply)
435
    {
436
6
      dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &ret,
437
                                DBUS_TYPE_INVALID);
438
    }
439
6
  return reply;
440
}
441

            
442
static DBusMessage *
443
2
impl_IsSelected (DBusConnection *bus, DBusMessage *message, void *user_data)
444
{
445
2
  AtkTable *table = (AtkTable *) user_data;
446
  dbus_int32_t row, column;
447
  DBusMessage *reply;
448
  dbus_bool_t ret;
449

            
450
2
  g_return_val_if_fail (ATK_IS_TABLE (user_data),
451
                        droute_not_yet_handled_error (message));
452
2
  if (!dbus_message_get_args (message, NULL, DBUS_TYPE_INT32, &row, DBUS_TYPE_INT32, &column,
453
                              DBUS_TYPE_INVALID))
454
    {
455
      return droute_invalid_arguments_error (message);
456
    }
457
2
  ret = atk_table_is_selected (table, row, column);
458
2
  reply = dbus_message_new_method_return (message);
459
2
  if (reply)
460
    {
461
2
      dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &ret,
462
                                DBUS_TYPE_INVALID);
463
    }
464
2
  return reply;
465
}
466

            
467
static DBusMessage *
468
1
impl_AddRowSelection (DBusConnection *bus, DBusMessage *message, void *user_data)
469
{
470
1
  AtkTable *table = (AtkTable *) user_data;
471
  dbus_int32_t row;
472
  DBusMessage *reply;
473
  dbus_bool_t ret;
474

            
475
1
  g_return_val_if_fail (ATK_IS_TABLE (user_data),
476
                        droute_not_yet_handled_error (message));
477
1
  if (!dbus_message_get_args (message, NULL, DBUS_TYPE_INT32, &row, DBUS_TYPE_INVALID))
478
    {
479
      return droute_invalid_arguments_error (message);
480
    }
481
1
  ret = atk_table_add_row_selection (table, row);
482
1
  reply = dbus_message_new_method_return (message);
483
1
  if (reply)
484
    {
485
1
      dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &ret,
486
                                DBUS_TYPE_INVALID);
487
    }
488
1
  return reply;
489
}
490

            
491
static DBusMessage *
492
1
impl_AddColumnSelection (DBusConnection *bus, DBusMessage *message, void *user_data)
493
{
494
1
  AtkTable *table = (AtkTable *) user_data;
495
  dbus_int32_t column;
496
  DBusMessage *reply;
497
  dbus_bool_t ret;
498

            
499
1
  g_return_val_if_fail (ATK_IS_TABLE (user_data),
500
                        droute_not_yet_handled_error (message));
501
1
  if (!dbus_message_get_args (message, NULL, DBUS_TYPE_INT32, &column, DBUS_TYPE_INVALID))
502
    {
503
      return droute_invalid_arguments_error (message);
504
    }
505
1
  ret = atk_table_add_column_selection (table, column);
506
1
  reply = dbus_message_new_method_return (message);
507
1
  if (reply)
508
    {
509
1
      dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &ret,
510
                                DBUS_TYPE_INVALID);
511
    }
512
1
  return reply;
513
}
514

            
515
static DBusMessage *
516
1
impl_RemoveRowSelection (DBusConnection *bus, DBusMessage *message, void *user_data)
517
{
518
1
  AtkTable *table = (AtkTable *) user_data;
519
  dbus_int32_t row;
520
  DBusMessage *reply;
521
  dbus_bool_t ret;
522

            
523
1
  g_return_val_if_fail (ATK_IS_TABLE (user_data),
524
                        droute_not_yet_handled_error (message));
525
1
  if (!dbus_message_get_args (message, NULL, DBUS_TYPE_INT32, &row, DBUS_TYPE_INVALID))
526
    {
527
      return droute_invalid_arguments_error (message);
528
    }
529
1
  ret = atk_table_remove_row_selection (table, row);
530
1
  reply = dbus_message_new_method_return (message);
531
1
  if (reply)
532
    {
533
1
      dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &ret,
534
                                DBUS_TYPE_INVALID);
535
    }
536
1
  return reply;
537
}
538

            
539
static DBusMessage *
540
1
impl_RemoveColumnSelection (DBusConnection *bus, DBusMessage *message, void *user_data)
541
{
542
1
  AtkTable *table = (AtkTable *) user_data;
543
  dbus_int32_t column;
544
  DBusMessage *reply;
545
  dbus_bool_t ret;
546

            
547
1
  g_return_val_if_fail (ATK_IS_TABLE (user_data),
548
                        droute_not_yet_handled_error (message));
549
1
  if (!dbus_message_get_args (message, NULL, DBUS_TYPE_INT32, &column, DBUS_TYPE_INVALID))
550
    {
551
      return droute_invalid_arguments_error (message);
552
    }
553
1
  ret = atk_table_remove_column_selection (table, column);
554
1
  reply = dbus_message_new_method_return (message);
555
1
  if (reply)
556
    {
557
1
      dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &ret,
558
                                DBUS_TYPE_INVALID);
559
    }
560
1
  return reply;
561
}
562

            
563
static DBusMessage *
564
1
impl_GetRowColumnExtentsAtIndex (DBusConnection *bus, DBusMessage *message, void *user_data)
565
{
566
1
  AtkTable *table = (AtkTable *) user_data;
567
  dbus_int32_t index;
568
  dbus_int32_t row, column, row_extents, col_extents;
569
  dbus_bool_t is_selected;
570
  dbus_bool_t ret;
571
  DBusMessage *reply;
572
  AtkObject *cell;
573
1
  AtkRole role = ATK_ROLE_INVALID;
574

            
575
1
  g_return_val_if_fail (ATK_IS_TABLE (user_data),
576
                        droute_not_yet_handled_error (message));
577
1
  if (!dbus_message_get_args (message, NULL, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
578
    {
579
      return droute_invalid_arguments_error (message);
580
    }
581
1
  column = atk_table_get_column_at_index (table, index);
582
1
  row = atk_table_get_row_at_index (table, index);
583
1
  row_extents = atk_table_get_row_extent_at (table, row, column);
584
1
  col_extents = atk_table_get_column_extent_at (table, row, column);
585
1
  is_selected = atk_table_is_selected (table, row, column);
586
1
  cell = atk_table_ref_at (table, row, column);
587
1
  if (cell)
588
    {
589
1
      role = atk_object_get_role (cell);
590
1
      g_object_unref (cell);
591
    }
592
1
  ret = (role == ATK_ROLE_TABLE_CELL ? TRUE : FALSE);
593
1
  reply = dbus_message_new_method_return (message);
594
1
  if (reply)
595
    {
596
1
      dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &ret,
597
                                DBUS_TYPE_INT32, &row, DBUS_TYPE_INT32,
598
                                &column, DBUS_TYPE_INT32, &row_extents,
599
                                DBUS_TYPE_INT32, &col_extents,
600
                                DBUS_TYPE_BOOLEAN, &is_selected,
601
                                DBUS_TYPE_INVALID);
602
    }
603
1
  return reply;
604
}
605

            
606
static DRouteMethod methods[] = {
607
  { impl_GetAccessibleAt, "GetAccessibleAt" },
608
  { impl_GetIndexAt, "GetIndexAt" },
609
  { impl_GetRowAtIndex, "GetRowAtIndex" },
610
  { impl_GetColumnAtIndex, "GetColumnAtIndex" },
611
  { impl_GetRowDescription, "GetRowDescription" },
612
  { impl_GetColumnDescription, "GetColumnDescription" },
613
  { impl_GetRowExtentAt, "GetRowExtentAt" },
614
  { impl_GetColumnExtentAt, "GetColumnExtentAt" },
615
  { impl_GetRowHeader, "GetRowHeader" },
616
  { impl_GetColumnHeader, "GetColumnHeader" },
617
  { impl_GetSelectedRows, "GetSelectedRows" },
618
  { impl_GetSelectedColumns, "GetSelectedColumns" },
619
  { impl_IsRowSelected, "IsRowSelected" },
620
  { impl_IsColumnSelected, "IsColumnSelected" },
621
  { impl_IsSelected, "IsSelected" },
622
  { impl_AddRowSelection, "AddRowSelection" },
623
  { impl_AddColumnSelection, "AddColumnSelection" },
624
  { impl_RemoveRowSelection, "RemoveRowSelection" },
625
  { impl_RemoveColumnSelection, "RemoveColumnSelection" },
626
  { impl_GetRowColumnExtentsAtIndex, "GetRowColumnExtentsAtIndex" },
627
  { NULL, NULL }
628
};
629

            
630
static DRouteProperty properties[] = {
631
  { impl_get_NRows, NULL, "NRows" },
632
  { impl_get_NColumns, NULL, "NColumns" },
633
  { impl_get_Caption, NULL, "Caption" },
634
  { impl_get_Summary, NULL, "Summary" },
635
  { impl_get_NSelectedRows, NULL, "NSelectedRows" },
636
  { impl_get_NSelectedColumns, NULL, "NSelectedColumns" },
637
  { impl_get_Version, NULL, "version" },
638
  { NULL, NULL, NULL }
639
};
640

            
641
void
642
161
spi_initialize_table (DRoutePath *path)
643
{
644
161
  spi_atk_add_interface (path,
645
                         ATSPI_DBUS_INTERFACE_TABLE,
646
                         spi_org_a11y_atspi_Table,
647
                         methods, properties);
648
161
};