FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
ActiveXCore/AXDOM/Document.h
1 /**********************************************************\
2 Original Author: Richard Bateman (taxilian)
3 
4 Created: Sep 21, 2010
5 License: Dual license model; choose one of two:
6  New BSD License
7  http://www.opensource.org/licenses/bsd-license.php
8  - or -
9  GNU Lesser General Public License, version 2.1
10  http://www.gnu.org/licenses/lgpl-2.1.html
11 
12 Copyright 2010 Facebook, Inc and the Firebreath development team
13 \**********************************************************/
14 
15 #pragma once
16 #ifndef H_AXDOM_DOCUMENT
17 #define H_AXDOM_DOCUMENT
18 
19 #include <string>
20 #include "win_common.h"
21 #include <atlctl.h>
22 #include "JSObject.h"
23 #include "Element.h"
24 #include "DOM/Document.h"
25 #include "DOM/Element.h"
26 
27 #ifdef _WIN32
28 #pragma warning(push)
29 #pragma warning( disable : 4250 )
30 #endif
31 namespace FB { namespace ActiveX {
32  namespace AXDOM {
33 
39  class Document : public virtual FB::ActiveX::AXDOM::Element, public virtual FB::DOM::Document
40  {
41  public:
42  Document(const FB::JSObjectPtr &element, IWebBrowser2 *web);
43  virtual ~Document();
44 
45  public:
46  virtual FB::DOM::WindowPtr getWindow() const;
47  virtual FB::DOM::ElementPtr getElementById(const std::string& elem_id) const;
48  virtual std::vector<FB::DOM::ElementPtr> getElementsByTagName(const std::string& tagName) const;
49  virtual FB::DOM::ElementPtr createElement(const std::string &name) const;
50  protected:
51  CComQIPtr<IWebBrowser> m_webBrowser;
52  CComQIPtr<IHTMLDocument2> m_htmlDoc;
53  };
54 
55  };
56 } }
57 #ifdef _WIN32
58 #pragma warning(pop)
59 #endif
60 
61 #endif // H_AXDOM_DOCUMENT
62 
ActiveX specific implementation of DOM::Document.
boost::shared_ptr< FB::JSObject > JSObjectPtr
Defines an alias representing a JSObject shared_ptr (you should never use a JSObject* directly) ...
Definition: APITypes.h:109
boost::shared_ptr< Window > WindowPtr
shared_ptr for a FB::DOM::Window
virtual std::vector< FB::DOM::ElementPtr > getElementsByTagName(const std::string &tagName) const
Gets a list of all elements in the document with the specified tag name.
virtual FB::DOM::WindowPtr getWindow() const
Gets a DOM::WindowPtr for the window the document is contained in.
boost::shared_ptr< Element > ElementPtr
shared_ptr for a FB::DOM::Element
ActiveX specific implementation of DOM::Element.
virtual FB::DOM::ElementPtr getElementById(const std::string &elem_id) const
Gets an element from the DOM with the specified id.
virtual FB::DOM::ElementPtr createElement(const std::string &name) const
roughly equivalent to calling document.createElement(name) from javascript
ElementPtr element()
Gets a FB::DOM::ElementPtr pointing to the current object.
Abstraction for accessing and manipulating a DOM Document.