Home | History | Annotate | Download | only in isimpledom
      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 (at) 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 
     39 cpp_quote("///////////////////////////////////////////////////////////////////////////////////////////////////////")
     40 cpp_quote("//")
     41 cpp_quote("// ISimpleDOMNode")
     42 cpp_quote("// ---------------------------------------------------------------------------------------------------=")
     43 cpp_quote("// An interface that extends MSAA's IAccessible to provide readonly DOM node information via cross-process COM.")
     44 cpp_quote("//")
     45 cpp_quote("// @STATUS UNDER_REVIEW")
     46 cpp_quote("//")
     47 cpp_quote("// get_nodeInfo(")
     48 cpp_quote("//  /* [out] */ BSTR  *nodeName,   // For elements, this is the tag name")
     49 cpp_quote("//  /* [out] */ short  *nameSpaceID,")
     50 cpp_quote("//  /* [out] */ BSTR  *nodeValue, ")
     51 cpp_quote("//  /* [out] */ unsigned int    *numChildren); ")
     52 cpp_quote("//  /* [out] */ unsigned int    *uniqueID;  // In Win32 accessible events we generate, the target's childID matches to this")
     53 cpp_quote("//  /* [out] */ unsigned short  *nodeType,")
     54 cpp_quote("// ---------------------------------------------------------------------------------------------------=")
     55 cpp_quote("// Get the basic information about a node.")
     56 cpp_quote("// The namespace ID can be mapped to an URI using nsISimpleDOMDocument::get_nameSpaceURIForID()")
     57 cpp_quote("//")
     58 cpp_quote("// get_attributes(")
     59 cpp_quote("//  /* [in]  */ unsigned short maxAttribs,")
     60 cpp_quote("//  /* [out] */ unsigned short  *numAttribs,")
     61 cpp_quote("//  /* [out] */ BSTR  *attribNames,")
     62 cpp_quote("//  /* [out] */ short *nameSpaceID,")
     63 cpp_quote("//  /* [out] */ BSTR  *attribValues);")
     64 cpp_quote("// ---------------------------------------------------------------------------------------------------=")
     65 cpp_quote("// Returns 3 arrays - the attribute names and values, and a namespace ID for each")
     66 cpp_quote("// If the namespace ID is 0, it's the same namespace as the node's namespace")
     67 cpp_quote("//")
     68 cpp_quote("// get_attributesForNames(")
     69 cpp_quote("//  /* [in] */ unsigned short numAttribs,")
     70 cpp_quote("//  /* [in] */ BSTR   *attribNames,")
     71 cpp_quote("//  /* [in] */ short  *nameSpaceID,")
     72 cpp_quote("//  /* [out] */ BSTR  *attribValues);")
     73 cpp_quote("// ---------------------------------------------------------------------------------------------------=")
     74 cpp_quote("// Takes 2 arrays - the attribute names and namespace IDs, and returns an array of corresponding values")
     75 cpp_quote("// If the namespace ID is 0, it's the same namespace as the node's namespace")
     76 cpp_quote("//")
     77 cpp_quote("// computedStyle(  ")
     78 cpp_quote("//  /* [in]  */ unsigned short maxStyleProperties,")
     79 cpp_quote("//  /* [out] */ unsigned short *numStyleProperties, ")
     80 cpp_quote("//  /* [in]  */ boolean useAlternateView,  // If TRUE, returns properites for media as set in nsIDOMDocument::set_alternateViewMediaTypes")
     81 cpp_quote("//  /* [out] */ BSTR *styleProperties, ")
     82 cpp_quote("//  /* [out] */ BSTR *styleValues);")
     83 cpp_quote("// ---------------------------------------------------------------------------------------------------=")
     84 cpp_quote("// Returns 2 arrays -- the style properties and their values")
     85 cpp_quote("//  useAlternateView=FALSE: gets properties for the default media type (usually screen)")
     86 cpp_quote("//  useAlternateView=TRUE: properties for media types set w/ nsIDOMSimpleDocument::set_alternateViewMediaTypes()")
     87 cpp_quote("//")
     88 cpp_quote("// computedStyleForProperties(  ")
     89 cpp_quote("//  /* [in] */  unsigned short numStyleProperties, ")
     90 cpp_quote("//  /* [in] */  boolean useAlternateView,  // If TRUE, returns properites for media as set in nsIDOMDocument::set_alternateViewMediaTypes")
     91 cpp_quote("//  /* [in] */  BSTR *styleProperties, ")
     92 cpp_quote("//  /* [out] */ BSTR *styleValues);")
     93 cpp_quote("// ---------------------------------------------------------------------------------------------------=")
     94 cpp_quote("// Scroll the current view so that this dom node is visible.")
     95 cpp_quote("//  placeTopLeft=TRUE: scroll until the top left corner of the dom node is at the top left corner of the view.")
     96 cpp_quote("//  placeTopLeft=FALSE: scroll minimally to make the dom node visible. Don't scroll at all if already visible.")
     97 cpp_quote("//")
     98 cpp_quote("// scrollTo( ")
     99 cpp_quote("//  /* [in] */ boolean placeTopLeft); ")
    100 cpp_quote("// ---------------------------------------------------------------------------------------------------=")
    101 cpp_quote("// Returns style property values for those properties in the styleProperties [in] array")
    102 cpp_quote("// Returns 2 arrays -- the style properties and their values")
    103 cpp_quote("//  useAlternateView=FALSE: gets properties for the default media type (usually screen)")
    104 cpp_quote("//  useAlternateView=TRUE: properties for media types set w/ nsIDOMSimpleDocument::set_alternateViewMediaTypes()")
    105 cpp_quote("//")
    106 cpp_quote("// get_parentNode     (/* [out] */ ISimpleDOMNode **newNodePtr);")
    107 cpp_quote("// get_firstChild     (/* [out] */ ISimpleDOMNode **newNodePtr);")
    108 cpp_quote("// get_lastChild      (/* [out] */ ISimpleDOMNode **newNodePtr);")
    109 cpp_quote("// get_previousSibling(/* [out] */ ISimpleDOMNode **newNodePtr);")
    110 cpp_quote("// get_nextSibling    (/* [out] */ ISimpleDOMNode **newNodePtr);")
    111 cpp_quote("// get_childAt        (/* [in] */ unsigned childIndex, /* [out] */ ISimpleDOMNode **newNodePtr);")
    112 cpp_quote("// ---------------------------------------------------------------------------------------------------=")
    113 cpp_quote("// DOM navigation - get a different node.")
    114 cpp_quote("//")
    115 cpp_quote("// get_innerHTML(/* [out] */ BSTR *htmlText);")
    116 cpp_quote("// ---------------------------------------------------------------------------------------------------=")
    117 cpp_quote("// Returns HTML of this DOM node's subtree. Does not include the start and end tag for this node/element.")
    118 cpp_quote("//")
    119 cpp_quote("//")
    120 cpp_quote("// get_localInterface(/* [out] */ void **localInterface);")
    121 cpp_quote("// ---------------------------------------------------------------------------------------------------=")
    122 cpp_quote("// Only available in Gecko's process - casts to an XPCOM nsIAccessNode interface pointer")
    123 cpp_quote("//")
    124 cpp_quote("//")
    125 cpp_quote("// get_language(/* [out] */ BSTR *htmlText);")
    126 cpp_quote("// ---------------------------------------------------------------------------------------------------=")
    127 cpp_quote("// Returns the computed language for this node, or empty string if unknown.")
    128 cpp_quote("//")
    129 cpp_quote("//")
    130 cpp_quote("///////////////////////////////////////////////////////////////////////////////////////////////////////")
    131 cpp_quote("")
    132 cpp_quote("")
    133 
    134 import "objidl.idl";
    135 import "oaidl.idl";
    136 
    137 const long DISPID_NODE_NODEINFO   = -5900;
    138 const long DISPID_NODE_ATTRIBUTES = -5901;
    139 const long DISPID_NODE_ATTRIBUTESFORNAMES = -5902;
    140 const long DISPID_NODE_COMPSTYLE  = -5903;
    141 const long DISPID_NODE_COMPSTYLEFORPROPS = -5904;
    142 const long DISPID_NODE_LANGUAGE = -5905;
    143 
    144 [object, uuid(1814ceeb-49e2-407f-af99-fa755a7d2607)]
    145 interface 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