xref: /aoo42x/main/vcl/unx/gtk/a11y/atkbridge.cxx (revision 9f62ea84)
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 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_vcl.hxx"
26 
27 #include <unx/gtk/atkbridge.hxx>
28 #include <unx/gtk/gtkframe.hxx>
29 
30 #include "atkfactory.hxx"
31 #include "atkutil.hxx"
32 #include "atkwindow.hxx"
33 #include <stdio.h>
34 
InitAtkBridge(void)35 bool InitAtkBridge(void)
36 {
37     const char* pVersion = atk_get_toolkit_version();
38     if( ! pVersion )
39         return false;
40 
41     unsigned int major, minor, micro;
42 
43     /* check gail minimum version requirements */
44     if( sscanf( pVersion, "%u.%u.%u", &major, &minor, &micro) < 3 )
45     {
46         // g_warning( "unable to parse gail version number" );
47         return false;
48     }
49 
50     if( ( (major << 16) | (minor << 8) | micro ) < ( (1 << 16) | 8 << 8 | 6 ) )
51     {
52         g_warning( "libgail >= 1.8.6 required for accessibility support" );
53         return false;
54     }
55 
56     /* Initialize the AtkUtilityWrapper class */
57     g_type_class_unref( g_type_class_ref( OOO_TYPE_ATK_UTIL ) );
58 
59     /* Initialize the GailWindow wrapper class */
60     g_type_class_unref( g_type_class_ref( OOO_TYPE_WINDOW_WRAPPER ) );
61 
62     /* Register AtkObject wrapper factory */
63     AtkRegistry * registry = atk_get_default_registry();
64     if( registry )
65         atk_registry_set_factory_type( registry, OOO_TYPE_FIXED, OOO_TYPE_WRAPPER_FACTORY );
66 
67     return true;
68 }
69 
DeInitAtkBridge()70 void DeInitAtkBridge()
71 {
72     restore_gail_window_vtable();
73 }
74 
75