1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=2 et sw=2 tw=80: */
3 : /* ***** BEGIN LICENSE BLOCK *****
4 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 : *
6 : * The contents of this file are subject to the Mozilla Public License Version
7 : * 1.1 (the "License"); you may not use this file except in compliance with
8 : * the License. You may obtain a copy of the License at
9 : * http://www.mozilla.org/MPL/
10 : *
11 : * Software distributed under the License is distributed on an "AS IS" basis,
12 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 : * for the specific language governing rights and limitations under the
14 : * License.
15 : *
16 : * The Original Code is mozilla.org code.
17 : *
18 : * The Initial Developer of the Original Code is
19 : * Sun Microsystems, Inc.
20 : * Portions created by the Initial Developer are Copyright (C) 2002
21 : * the Initial Developer. All Rights Reserved.
22 : *
23 : * Contributor(s):
24 : * Bolian Yin (bolian.yin@sun.com)
25 : * John Sun (john.sun@sun.com)
26 : *
27 : * Alternatively, the contents of this file may be used under the terms of
28 : * either the GNU General Public License Version 2 or later (the "GPL"), or
29 : * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 : * in which case the provisions of the GPL or the LGPL are applicable instead
31 : * of those above. If you wish to allow use of your version of this file only
32 : * under the terms of either the GPL or the LGPL, and not to allow others to
33 : * use your version of this file under the terms of the MPL, indicate your
34 : * decision by deleting the provisions above and replace them with the notice
35 : * and other provisions required by the GPL or the LGPL. If you do not delete
36 : * the provisions above, a recipient may use your version of this file under
37 : * the terms of any one of the MPL, the GPL or the LGPL.
38 : *
39 : * ***** END LICENSE BLOCK ***** */
40 :
41 : #ifndef __NS_ACCESSIBLE_WRAP_H__
42 : #define __NS_ACCESSIBLE_WRAP_H__
43 :
44 : #include "nsCOMPtr.h"
45 : #include "nsAccessible.h"
46 : #include "prlog.h"
47 :
48 : #ifdef PR_LOGGING
49 : #define MAI_LOGGING
50 : #endif /* #ifdef PR_LOGGING */
51 :
52 : struct _AtkObject;
53 : typedef struct _AtkObject AtkObject;
54 :
55 : enum AtkProperty {
56 : PROP_0, // gobject convention
57 : PROP_NAME,
58 : PROP_DESCRIPTION,
59 : PROP_PARENT, // ancestry has changed
60 : PROP_ROLE,
61 : PROP_LAYER,
62 : PROP_MDI_ZORDER,
63 : PROP_TABLE_CAPTION,
64 : PROP_TABLE_COLUMN_DESCRIPTION,
65 : PROP_TABLE_COLUMN_HEADER,
66 : PROP_TABLE_ROW_DESCRIPTION,
67 : PROP_TABLE_ROW_HEADER,
68 : PROP_TABLE_SUMMARY,
69 : PROP_LAST // gobject convention
70 : };
71 :
72 : struct AtkPropertyChange {
73 : PRInt32 type; // property type as listed above
74 : void *oldvalue;
75 : void *newvalue;
76 : };
77 :
78 : class MaiHyperlink;
79 :
80 : /**
81 : * nsAccessibleWrap, and its descendents in atk directory provide the
82 : * implementation of AtkObject.
83 : */
84 : class nsAccessibleWrap: public nsAccessible
85 : {
86 : public:
87 : nsAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc);
88 : virtual ~nsAccessibleWrap();
89 : void ShutdownAtkObject();
90 :
91 : // nsAccessNode
92 : virtual void Shutdown();
93 :
94 : #ifdef MAI_LOGGING
95 0 : virtual void DumpnsAccessibleWrapInfo(int aDepth) {}
96 : static PRInt32 mAccWrapCreated;
97 : static PRInt32 mAccWrapDeleted;
98 : #endif
99 :
100 : // return the atk object for this nsAccessibleWrap
101 : NS_IMETHOD GetNativeInterface(void **aOutAccessible);
102 : virtual nsresult HandleAccEvent(AccEvent* aEvent);
103 :
104 : AtkObject * GetAtkObject(void);
105 : static AtkObject * GetAtkObject(nsIAccessible * acc);
106 :
107 : bool IsValidObject();
108 :
109 : // get/set the MaiHyperlink object for this nsAccessibleWrap
110 : MaiHyperlink* GetMaiHyperlink(bool aCreate = true);
111 : void SetMaiHyperlink(MaiHyperlink* aMaiHyperlink);
112 :
113 0 : static const char * ReturnString(nsAString &aString) {
114 0 : static nsCString returnedString;
115 0 : returnedString = NS_ConvertUTF16toUTF8(aString);
116 0 : return returnedString.get();
117 : }
118 :
119 : protected:
120 : virtual nsresult FirePlatformEvent(AccEvent* aEvent);
121 :
122 : nsresult FireAtkStateChangeEvent(AccEvent* aEvent, AtkObject *aObject);
123 : nsresult FireAtkTextChangedEvent(AccEvent* aEvent, AtkObject *aObject);
124 : nsresult FireAtkShowHideEvent(AccEvent* aEvent, AtkObject *aObject,
125 : bool aIsAdded);
126 :
127 : AtkObject *mAtkObject;
128 :
129 : private:
130 :
131 : /*
132 : * do we have text-remove and text-insert signals if not we need to use
133 : * text-changed see nsAccessibleWrap::FireAtkTextChangedEvent() and
134 : * bug 619002
135 : */
136 : enum EAvailableAtkSignals {
137 : eUnknown,
138 : eHaveNewAtkTextSignals,
139 : eNoNewAtkSignals
140 : };
141 :
142 : static EAvailableAtkSignals gAvailableAtkSignals;
143 :
144 : PRUint16 CreateMaiInterfaces(void);
145 : };
146 :
147 : #endif /* __NS_ACCESSIBLE_WRAP_H__ */
|