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 SVG Project code.
16 : *
17 : * The Initial Developer of the Original Code is Jonathan Watt.
18 : * Portions created by the Initial Developer are Copyright (C) 2006
19 : * the Initial Developer. All Rights Reserved.
20 : *
21 : * Contributor(s):
22 : * Jonathan Watt <jwatt@jwatt.org> (original author)
23 : *
24 : * Alternatively, the contents of this file may be used under the terms of
25 : * either of the GNU General Public License Version 2 or later (the "GPL"),
26 : * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 : * in which case the provisions of the GPL or the LGPL are applicable instead
28 : * of those above. If you wish to allow use of your version of this file only
29 : * under the terms of either the GPL or the LGPL, and not to allow others to
30 : * use your version of this file under the terms of the MPL, indicate your
31 : * decision by deleting the provisions above and replace them with the notice
32 : * and other provisions required by the GPL or the LGPL. If you do not delete
33 : * the provisions above, a recipient may use your version of this file under
34 : * the terms of any one of the MPL, the GPL or the LGPL.
35 : *
36 : * ***** END LICENSE BLOCK ***** */
37 :
38 : #ifndef NS_SVGAELEMENT_H_
39 : #define NS_SVGAELEMENT_H_
40 :
41 : #include "DOMSVGTests.h"
42 : #include "Link.h"
43 : #include "nsIDOMSVGAElement.h"
44 : #include "nsIDOMSVGURIReference.h"
45 : #include "nsILink.h"
46 : #include "nsSVGGraphicElement.h"
47 : #include "nsSVGString.h"
48 :
49 : typedef nsSVGGraphicElement nsSVGAElementBase;
50 :
51 : class nsSVGAElement : public nsSVGAElementBase,
52 : public nsIDOMSVGAElement,
53 : public DOMSVGTests,
54 : public nsIDOMSVGURIReference,
55 : public nsILink,
56 : public mozilla::dom::Link
57 0 : {
58 : protected:
59 : friend nsresult NS_NewSVGAElement(nsIContent **aResult,
60 : already_AddRefed<nsINodeInfo> aNodeInfo);
61 : nsSVGAElement(already_AddRefed<nsINodeInfo> aNodeInfo);
62 :
63 : public:
64 : // interfaces:
65 :
66 : NS_DECL_ISUPPORTS_INHERITED
67 : NS_DECL_NSIDOMSVGAELEMENT
68 : NS_DECL_NSIDOMSVGURIREFERENCE
69 :
70 : // XXX: I wish we could use virtual inheritance
71 0 : NS_FORWARD_NSIDOMNODE(nsSVGAElementBase::)
72 0 : NS_FORWARD_NSIDOMELEMENT(nsSVGAElementBase::)
73 0 : NS_FORWARD_NSIDOMSVGELEMENT(nsSVGAElementBase::)
74 :
75 : // nsINode interface methods
76 : virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
77 : virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);
78 : virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
79 :
80 : // nsILink
81 0 : NS_IMETHOD LinkAdded() { return NS_OK; }
82 0 : NS_IMETHOD LinkRemoved() { return NS_OK; }
83 :
84 : // nsIContent
85 : virtual nsresult BindToTree(nsIDocument *aDocument, nsIContent *aParent,
86 : nsIContent *aBindingParent,
87 : bool aCompileEventHandlers);
88 : virtual void UnbindFromTree(bool aDeep = true,
89 : bool aNullParent = true);
90 : NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
91 : virtual bool IsFocusable(PRInt32 *aTabIndex = nsnull, bool aWithMouse = false);
92 : virtual bool IsLink(nsIURI** aURI) const;
93 : virtual void GetLinkTarget(nsAString& aTarget);
94 : virtual nsLinkState GetLinkState() const;
95 : virtual already_AddRefed<nsIURI> GetHrefURI() const;
96 : virtual nsEventStates IntrinsicState() const;
97 : nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
98 : const nsAString& aValue, bool aNotify)
99 : {
100 : return SetAttr(aNameSpaceID, aName, nsnull, aValue, aNotify);
101 : }
102 : virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
103 : nsIAtom* aPrefix, const nsAString& aValue,
104 : bool aNotify);
105 : virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
106 : bool aNotify);
107 :
108 : virtual nsXPCClassInfo* GetClassInfo();
109 : protected:
110 :
111 : virtual StringAttributesInfo GetStringInfo();
112 :
113 : enum { HREF, TARGET };
114 : nsSVGString mStringAttributes[2];
115 : static StringInfo sStringInfo[2];
116 : };
117 :
118 : #endif // NS_SVGAELEMENT_H_
|