michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef __inDOMView_h__ michael@0: #define __inDOMView_h__ michael@0: michael@0: #include "inIDOMView.h" michael@0: #include "inIDOMUtils.h" michael@0: michael@0: #include "nsITreeView.h" michael@0: #include "nsITreeSelection.h" michael@0: #include "nsStubMutationObserver.h" michael@0: #include "nsIDOMNode.h" michael@0: #include "nsIDOMDocument.h" michael@0: #include "nsTArray.h" michael@0: #include "nsCOMArray.h" michael@0: #include "nsCOMPtr.h" michael@0: michael@0: class inDOMViewNode; michael@0: class nsIDOMMozNamedAttrMap; michael@0: michael@0: class inDOMView : public inIDOMView, michael@0: public nsITreeView, michael@0: public nsStubMutationObserver michael@0: { michael@0: public: michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_INIDOMVIEW michael@0: NS_DECL_NSITREEVIEW michael@0: michael@0: inDOMView(); michael@0: virtual ~inDOMView(); michael@0: michael@0: // nsIMutationObserver michael@0: NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED michael@0: NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED michael@0: NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED michael@0: NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED michael@0: NS_DECL_NSIMUTATIONOBSERVER_NODEWILLBEDESTROYED michael@0: michael@0: protected: michael@0: nsCOMPtr mTree; michael@0: nsCOMPtr mSelection; michael@0: nsCOMPtr mDOMUtils; michael@0: michael@0: bool mShowAnonymous; michael@0: bool mShowSubDocuments; michael@0: bool mShowWhitespaceNodes; michael@0: bool mShowAccessibleNodes; michael@0: uint32_t mWhatToShow; michael@0: michael@0: nsCOMPtr mRootNode; michael@0: nsCOMPtr mRootDocument; michael@0: michael@0: nsTArray mNodes; michael@0: michael@0: inDOMViewNode* GetNodeAt(int32_t aIndex); michael@0: int32_t GetRowCount(); michael@0: int32_t NodeToRow(inDOMViewNode* aNode); michael@0: bool RowOutOfBounds(int32_t aRow, int32_t aCount); michael@0: inDOMViewNode* CreateNode(nsIDOMNode* aNode, inDOMViewNode* aParent); michael@0: void AppendNode(inDOMViewNode* aNode); michael@0: void InsertNode(inDOMViewNode* aNode, int32_t aIndex); michael@0: void RemoveNode(int32_t aIndex); michael@0: void ReplaceNode(inDOMViewNode* aNode, int32_t aIndex); michael@0: void InsertNodes(nsTArray& aNodes, int32_t aIndex); michael@0: void RemoveNodes(int32_t aIndex, int32_t aCount); michael@0: void RemoveAllNodes(); michael@0: void ExpandNode(int32_t aRow); michael@0: void CollapseNode(int32_t aRow); michael@0: michael@0: nsresult RowToNode(int32_t aRow, inDOMViewNode** aNode); michael@0: nsresult NodeToRow(nsIDOMNode* aNode, int32_t* aRow); michael@0: michael@0: void InsertLinkAfter(inDOMViewNode* aNode, inDOMViewNode* aInsertAfter); michael@0: void InsertLinkBefore(inDOMViewNode* aNode, inDOMViewNode* aInsertBefore); michael@0: void RemoveLink(inDOMViewNode* aNode); michael@0: void ReplaceLink(inDOMViewNode* aNewNode, inDOMViewNode* aOldNode); michael@0: michael@0: nsresult GetChildNodesFor(nsIDOMNode* aNode, nsCOMArray& aResult); michael@0: nsresult AppendKidsToArray(nsIDOMNodeList* aKids, nsCOMArray& aArray); michael@0: nsresult AppendAttrsToArray(nsIDOMMozNamedAttrMap* aKids, nsCOMArray& aArray); michael@0: nsresult GetFirstDescendantOf(inDOMViewNode* aNode, int32_t aRow, int32_t* aResult); michael@0: nsresult GetLastDescendantOf(inDOMViewNode* aNode, int32_t aRow, int32_t* aResult); michael@0: nsresult GetRealPreviousSibling(nsIDOMNode* aNode, nsIDOMNode* aRealParent, nsIDOMNode** aSibling); michael@0: }; michael@0: michael@0: // {FB5C1775-1BBD-4b9c-ABB0-AE7ACD29E87E} michael@0: #define IN_DOMVIEW_CID \ michael@0: { 0xfb5c1775, 0x1bbd, 0x4b9c, { 0xab, 0xb0, 0xae, 0x7a, 0xcd, 0x29, 0xe8, 0x7e } } michael@0: michael@0: #endif // __inDOMView_h__ michael@0: michael@0: