2008-08-25 Mark Doffman <mark.doffman@codethink.co.uk>
[platform/core/uifw/at-spi2-atk.git] / pyatspi / document.py
1 #Copyright (C) 2008 Codethink Ltd
2
3 #This library is free software; you can redistribute it and/or
4 #modify it under the terms of the GNU Lesser General Public
5 #License version 2 as published by the Free Software Foundation.
6
7 #This program is distributed in the hope that it will be useful,
8 #but WITHOUT ANY WARRANTY; without even the implied warranty of
9 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10 #GNU General Public License for more details.
11 #You should have received a copy of the GNU Lesser General Public License
12 #along with this program; if not, write to the Free Software
13 #Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
14
15 import interfaces
16 from base import BaseProxy
17 from factory import add_accessible_class
18
19 __all__ = [
20            "Document",
21           ]
22
23 #------------------------------------------------------------------------------
24
25 class Document(BaseProxy):
26     """
27     Primarily a 'tagging' interface which indicates the start of
28     document content in the Accessibility hierarchy. Accessible objects
29     below the node implementing Document are normally assumed to
30     be part of the document content. Attributes of Document are those
31     attributes associated with the document as a whole. Objects that
32     implement Document are normally expected to implement Collection
33     as well.
34     """
35     
36     def getAttributeValue(self, *args, **kwargs):
37         """
38         Gets the value of a single attribute, if specified for the document
39         as a whole.
40         @param : attributename
41         a string indicating the name of a specific attribute (name-value
42         pair) being queried.
43         @return a string corresponding to the value of the specified
44         attribute, or an empty string if the attribute is unspecified
45         for the object.
46         """
47         func = self.get_dbus_method("getAttributeValue")
48         return func(*args, **kwargs)
49     
50     def getAttributes(self, *args, **kwargs):
51         """
52         Gets all attributes specified for a document as a whole. For
53         attributes which change within the document content, see Accessibility::Text::getAttributes
54         instead.
55         @return an AttributeSet containing the attributes of the document,
56         as name-value pairs.
57         """
58         func = self.get_dbus_method("getAttributes")
59         return func(*args, **kwargs)
60     
61     def getLocale(self, *args, **kwargs):
62         """
63         Gets the locale associated with the document's content. e.g.
64         the locale for LOCALE_TYPE_MESSAGES.
65         @return a string compliant with the POSIX standard for locale
66         description.
67         """
68         func = self.get_dbus_method("getLocale")
69         return func(*args, **kwargs)
70     
71 # ATTENTION - Register the Application class with the accessible factory.
72 add_accessible_class(interfaces.ATSPI_DOCUMENT, Document)
73
74 #END----------------------------------------------------------------------------