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 the Mozilla SMIL module.
16 : *
17 : * The Initial Developer of the Original Code is Brian Birtles.
18 : * Portions created by the Initial Developer are Copyright (C) 2005
19 : * the Initial Developer. All Rights Reserved.
20 : *
21 : * Contributor(s):
22 : * Brian Birtles <birtles@gmail.com>
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_ISMILATTR_H_
39 : #define NS_ISMILATTR_H_
40 :
41 : #include "nsStringFwd.h"
42 :
43 : class nsSMILValue;
44 : class nsISMILType;
45 : class nsISMILAnimationElement;
46 : class nsIContent;
47 :
48 : ////////////////////////////////////////////////////////////////////////
49 : // nsISMILAttr: A variable targeted by SMIL for animation and can therefore have
50 : // an underlying (base) value and an animated value For example, an attribute of
51 : // a particular SVG element.
52 : //
53 : // These objects only exist during the compositing phase of SMIL animation
54 : // calculations. They have a single owner who is responsible for deleting the
55 : // object.
56 :
57 : class nsISMILAttr
58 0 : {
59 : public:
60 : /**
61 : * Creates a new nsSMILValue for this attribute from a string. The string is
62 : * parsed in the context of this attribute so that context-dependent values
63 : * such as em-based units can be resolved into a canonical form suitable for
64 : * animation (including interpolation etc.).
65 : *
66 : * @param aStr A string defining the new value to be created.
67 : * @param aSrcElement The source animation element. This may be needed to
68 : * provided additional context data such as for
69 : * animateTransform where the 'type' attribute is needed to
70 : * parse the value.
71 : * @param[out] aValue Outparam for storing the parsed value.
72 : * @param[out] aPreventCachingOfSandwich
73 : * Outparam to indicate whether the attribute contains
74 : * dependencies on its context that should prevent the
75 : * result of the animation sandwich from being cached and
76 : * reused in future samples.
77 : * @return NS_OK on success or an error code if creation failed.
78 : */
79 : virtual nsresult ValueFromString(const nsAString& aStr,
80 : const nsISMILAnimationElement* aSrcElement,
81 : nsSMILValue& aValue,
82 : bool& aPreventCachingOfSandwich) const = 0;
83 :
84 : /**
85 : * Gets the underlying value of this attribute.
86 : *
87 : * @return an nsSMILValue object. returned_object.IsNull() will be true if an
88 : * error occurred.
89 : */
90 : virtual nsSMILValue GetBaseValue() const = 0;
91 :
92 : /**
93 : * Clears the animated value of this attribute.
94 : *
95 : * NOTE: The animation target is not guaranteed to be in a document when this
96 : * method is called. (See bug 523188)
97 : */
98 : virtual void ClearAnimValue() = 0;
99 :
100 : /**
101 : * Sets the presentation value of this attribute.
102 : *
103 : * @param aValue The value to set.
104 : * @return NS_OK on success or an error code if setting failed.
105 : */
106 : virtual nsresult SetAnimValue(const nsSMILValue& aValue) = 0;
107 :
108 : /**
109 : * Returns the targeted content node, for any nsISMILAttr implementations
110 : * that want to expose that to the animation logic. Otherwise, returns
111 : * null.
112 : *
113 : * @return the targeted content node, if this nsISMILAttr implementation
114 : * wishes to make it avaiable. Otherwise, nsnull.
115 : */
116 0 : virtual const nsIContent* GetTargetNode() const { return nsnull; }
117 :
118 : /**
119 : * Virtual destructor, to make sure subclasses can clean themselves up.
120 : */
121 0 : virtual ~nsISMILAttr() {}
122 : };
123 :
124 : #endif // NS_ISMILATTR_H_
|