1/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2/* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is mozilla.org code.
16 *
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 *   Author: Aaron Leventhal (aaronl@netscape.com)
24 *
25 * Alternatively, the contents of this file may be used under the terms of
26 * either of the GNU General Public License Version 2 or later (the "GPL"),
27 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
36 *
37 * ***** END LICENSE BLOCK ***** */
38
39cpp_quote("///////////////////////////////////////////////////////////////////////////////////////////////////////")
40cpp_quote("//")
41cpp_quote("// ISimpleDOMNode")
42cpp_quote("// ---------------------------------------------------------------------------------------------------=")
43cpp_quote("// An interface that extends MSAA's IAccessible to provide readonly DOM node information via cross-process COM.")
44cpp_quote("//")
45cpp_quote("// @STATUS UNDER_REVIEW")
46cpp_quote("//")
47cpp_quote("// get_nodeInfo(")
48cpp_quote("//  /* [out] */ BSTR  *nodeName,   // For elements, this is the tag name")
49cpp_quote("//  /* [out] */ short  *nameSpaceID,")
50cpp_quote("//  /* [out] */ BSTR  *nodeValue, ")
51cpp_quote("//  /* [out] */ unsigned int    *numChildren); ")
52cpp_quote("//  /* [out] */ unsigned int    *uniqueID;  // In Win32 accessible events we generate, the target's childID matches to this")
53cpp_quote("//  /* [out] */ unsigned short  *nodeType,")
54cpp_quote("// ---------------------------------------------------------------------------------------------------=")
55cpp_quote("// Get the basic information about a node.")
56cpp_quote("// The namespace ID can be mapped to an URI using nsISimpleDOMDocument::get_nameSpaceURIForID()")
57cpp_quote("//")
58cpp_quote("// get_attributes(")
59cpp_quote("//  /* [in]  */ unsigned short maxAttribs,")
60cpp_quote("//  /* [out] */ unsigned short  *numAttribs,")
61cpp_quote("//  /* [out] */ BSTR  *attribNames,")
62cpp_quote("//  /* [out] */ short *nameSpaceID,")
63cpp_quote("//  /* [out] */ BSTR  *attribValues);")
64cpp_quote("// ---------------------------------------------------------------------------------------------------=")
65cpp_quote("// Returns 3 arrays - the attribute names and values, and a namespace ID for each")
66cpp_quote("// If the namespace ID is 0, it's the same namespace as the node's namespace")
67cpp_quote("//")
68cpp_quote("// get_attributesForNames(")
69cpp_quote("//  /* [in] */ unsigned short numAttribs,")
70cpp_quote("//  /* [in] */ BSTR   *attribNames,")
71cpp_quote("//  /* [in] */ short  *nameSpaceID,")
72cpp_quote("//  /* [out] */ BSTR  *attribValues);")
73cpp_quote("// ---------------------------------------------------------------------------------------------------=")
74cpp_quote("// Takes 2 arrays - the attribute names and namespace IDs, and returns an array of corresponding values")
75cpp_quote("// If the namespace ID is 0, it's the same namespace as the node's namespace")
76cpp_quote("//")
77cpp_quote("// computedStyle(  ")
78cpp_quote("//  /* [in]  */ unsigned short maxStyleProperties,")
79cpp_quote("//  /* [out] */ unsigned short *numStyleProperties, ")
80cpp_quote("//  /* [in]  */ boolean useAlternateView,  // If TRUE, returns properites for media as set in nsIDOMDocument::set_alternateViewMediaTypes")
81cpp_quote("//  /* [out] */ BSTR *styleProperties, ")
82cpp_quote("//  /* [out] */ BSTR *styleValues);")
83cpp_quote("// ---------------------------------------------------------------------------------------------------=")
84cpp_quote("// Returns 2 arrays -- the style properties and their values")
85cpp_quote("//  useAlternateView=FALSE: gets properties for the default media type (usually screen)")
86cpp_quote("//  useAlternateView=TRUE: properties for media types set w/ nsIDOMSimpleDocument::set_alternateViewMediaTypes()")
87cpp_quote("//")
88cpp_quote("// computedStyleForProperties(  ")
89cpp_quote("//  /* [in] */  unsigned short numStyleProperties, ")
90cpp_quote("//  /* [in] */  boolean useAlternateView,  // If TRUE, returns properites for media as set in nsIDOMDocument::set_alternateViewMediaTypes")
91cpp_quote("//  /* [in] */  BSTR *styleProperties, ")
92cpp_quote("//  /* [out] */ BSTR *styleValues);")
93cpp_quote("// ---------------------------------------------------------------------------------------------------=")
94cpp_quote("// Scroll the current view so that this dom node is visible.")
95cpp_quote("//  placeTopLeft=TRUE: scroll until the top left corner of the dom node is at the top left corner of the view.")
96cpp_quote("//  placeTopLeft=FALSE: scroll minimally to make the dom node visible. Don't scroll at all if already visible.")
97cpp_quote("//")
98cpp_quote("// scrollTo( ")
99cpp_quote("//  /* [in] */ boolean placeTopLeft); ")
100cpp_quote("// ---------------------------------------------------------------------------------------------------=")
101cpp_quote("// Returns style property values for those properties in the styleProperties [in] array")
102cpp_quote("// Returns 2 arrays -- the style properties and their values")
103cpp_quote("//  useAlternateView=FALSE: gets properties for the default media type (usually screen)")
104cpp_quote("//  useAlternateView=TRUE: properties for media types set w/ nsIDOMSimpleDocument::set_alternateViewMediaTypes()")
105cpp_quote("//")
106cpp_quote("// get_parentNode     (/* [out] */ ISimpleDOMNode **newNodePtr);")
107cpp_quote("// get_firstChild     (/* [out] */ ISimpleDOMNode **newNodePtr);")
108cpp_quote("// get_lastChild      (/* [out] */ ISimpleDOMNode **newNodePtr);")
109cpp_quote("// get_previousSibling(/* [out] */ ISimpleDOMNode **newNodePtr);")
110cpp_quote("// get_nextSibling    (/* [out] */ ISimpleDOMNode **newNodePtr);")
111cpp_quote("// get_childAt        (/* [in] */ unsigned childIndex, /* [out] */ ISimpleDOMNode **newNodePtr);")
112cpp_quote("// ---------------------------------------------------------------------------------------------------=")
113cpp_quote("// DOM navigation - get a different node.")
114cpp_quote("//")
115cpp_quote("// get_innerHTML(/* [out] */ BSTR *htmlText);")
116cpp_quote("// ---------------------------------------------------------------------------------------------------=")
117cpp_quote("// Returns HTML of this DOM node's subtree. Does not include the start and end tag for this node/element.")
118cpp_quote("//")
119cpp_quote("//")
120cpp_quote("// get_localInterface(/* [out] */ void **localInterface);")
121cpp_quote("// ---------------------------------------------------------------------------------------------------=")
122cpp_quote("// Only available in Gecko's process - casts to an XPCOM nsIAccessNode interface pointer")
123cpp_quote("//")
124cpp_quote("//")
125cpp_quote("// get_language(/* [out] */ BSTR *htmlText);")
126cpp_quote("// ---------------------------------------------------------------------------------------------------=")
127cpp_quote("// Returns the computed language for this node, or empty string if unknown.")
128cpp_quote("//")
129cpp_quote("//")
130cpp_quote("///////////////////////////////////////////////////////////////////////////////////////////////////////")
131cpp_quote("")
132cpp_quote("")
133
134import "objidl.idl";
135import "oaidl.idl";
136
137const long DISPID_NODE_NODEINFO   = -5900;
138const long DISPID_NODE_ATTRIBUTES = -5901;
139const long DISPID_NODE_ATTRIBUTESFORNAMES = -5902;
140const long DISPID_NODE_COMPSTYLE  = -5903;
141const long DISPID_NODE_COMPSTYLEFORPROPS = -5904;
142const long DISPID_NODE_LANGUAGE = -5905;
143
144[object, uuid(1814ceeb-49e2-407f-af99-fa755a7d2607)]
145interface ISimpleDOMNode : IUnknown
146{
147  const unsigned short NODETYPE_ELEMENT = 1;
148  const unsigned short NODETYPE_ATTRIBUTE = 2;
149  const unsigned short NODETYPE_TEXT = 3;
150  const unsigned short NODETYPE_CDATA_SECTION = 4;
151  const unsigned short NODETYPE_ENTITY_REFERENCE = 5;
152  const unsigned short NODETYPE_ENTITY = 6;
153  const unsigned short NODETYPE_PROCESSING_INSTRUCTION = 7;
154  const unsigned short NODETYPE_COMMENT = 8;
155  const unsigned short NODETYPE_DOCUMENT = 9;
156  const unsigned short NODETYPE_DOCUMENT_TYPE = 10;
157  const unsigned short NODETYPE_DOCUMENT_FRAGMENT = 11;
158  const unsigned short NODETYPE_NOTATION = 12;
159
160  [propget, id(DISPID_NODE_NODEINFO)] HRESULT nodeInfo(
161    [out] BSTR *nodeName,   // for performance returns NULL for text nodes (true nodeName would be "#text")
162    [out] short *nameSpaceID,
163    [out] BSTR *nodeValue,
164    [out] unsigned int *numChildren,
165    [out] unsigned int *uniqueID, // In Win32 accessible events we generate, the target's childID matches to this
166    [out, retval] unsigned short *nodeType
167  );
168
169  [propget, id(DISPID_NODE_ATTRIBUTES)] HRESULT attributes(
170    [in] unsigned short maxAttribs,
171    [out, size_is(maxAttribs), length_is(*numAttribs)] BSTR *attribNames,
172    [out, size_is(maxAttribs), length_is(*numAttribs)] short *nameSpaceID,
173    [out, size_is(maxAttribs), length_is(*numAttribs)] BSTR *attribValues,
174    [out, retval] unsigned short *numAttribs
175  );
176
177  [propget, id(DISPID_NODE_ATTRIBUTESFORNAMES)] HRESULT attributesForNames(
178    [in] unsigned short numAttribs,
179    [in, size_is(numAttribs), length_is(numAttribs)] BSTR *attribNames,
180    [in, size_is(numAttribs), length_is(numAttribs)] short *nameSpaceID,
181    [out, retval, size_is(numAttribs), length_is(numAttribs)] BSTR *attribValues
182  );
183
184  [propget, id(DISPID_NODE_COMPSTYLE)] HRESULT computedStyle(
185    [in] unsigned short maxStyleProperties,
186    [in] boolean useAlternateView,  // If TRUE, returns properites for media as set in nsIDOMDocument::set_alternateViewMediaTypes
187    [out, size_is(maxStyleProperties), length_is(*numStyleProperties)] BSTR *styleProperties,
188    [out, size_is(maxStyleProperties), length_is(*numStyleProperties)] BSTR *styleValues,
189    [out, retval] unsigned short *numStyleProperties
190  );
191
192  [propget, id(DISPID_NODE_COMPSTYLEFORPROPS)] HRESULT computedStyleForProperties(
193    [in] unsigned short numStyleProperties,
194    [in] boolean useAlternateView,  // If TRUE, returns properites for media as set in nsIDOMDocument::set_alternateViewMediaTypes
195    [in, size_is(numStyleProperties), length_is(numStyleProperties)] BSTR *styleProperties,
196    [out, retval, size_is(numStyleProperties), length_is(numStyleProperties)] BSTR *styleValues
197  );
198
199  HRESULT scrollTo([in] boolean placeTopLeft);
200
201  [propget] HRESULT parentNode([out, retval] ISimpleDOMNode **node);
202  [propget] HRESULT firstChild([out, retval] ISimpleDOMNode **node);
203  [propget] HRESULT lastChild([out, retval] ISimpleDOMNode **node);
204  [propget] HRESULT previousSibling([out, retval] ISimpleDOMNode **node);
205  [propget] HRESULT nextSibling([out, retval] ISimpleDOMNode **node);
206  [propget] HRESULT childAt([in] unsigned childIndex,
207                            [out, retval] ISimpleDOMNode **node);
208
209  [propget] HRESULT innerHTML([out, retval] BSTR *innerHTML);
210
211  [propget, local] HRESULT localInterface([out][retval] void **localInterface);
212
213  [propget, id(DISPID_NODE_LANGUAGE)] HRESULT language([out, retval] BSTR *language);
214}
215
216
217