2 Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
3 2004, 2005 Rob Buis <buis@kde.org>
5 This file is part of the KDE project
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.
23 #ifndef SVGSVGElement_H
24 #define SVGSVGElement_H
28 #include "SVGLangSpace.h"
29 #include "SVGFitToViewBox.h"
30 #include "SVGZoomAndPan.h"
31 #include "SVGStyledLocatableElement.h"
32 #include "SVGExternalResourcesRequired.h"
43 class SVGSVGElement : public SVGStyledLocatableElement,
46 public SVGExternalResourcesRequired,
47 public SVGFitToViewBox,
51 enum SVGZoomAndPanType {
52 SVG_ZOOMANDPAN_UNKNOWN = 0,
53 SVG_ZOOMANDPAN_DISABLE = 1,
54 SVG_ZOOMANDPAN_MAGNIFY = 2
57 SVGSVGElement(const QualifiedName&, Document*);
58 virtual ~SVGSVGElement();
60 virtual bool isSVG() const { return true; }
62 virtual bool isValid() const { return SVGTests::isValid(); }
64 // 'SVGSVGElement' functions
65 AtomicString contentScriptType() const;
66 void setContentScriptType(const AtomicString& type);
68 AtomicString contentStyleType() const;
69 void setContentStyleType(const AtomicString& type);
71 FloatRect viewport() const;
73 float pixelUnitToMillimeterX() const;
74 float pixelUnitToMillimeterY() const;
75 float screenPixelToMillimeterX() const;
76 float screenPixelToMillimeterY() const;
78 bool useCurrentView() const;
79 void setUseCurrentView(bool currentView);
81 // SVGViewSpec *currentView() const;
83 float currentScale() const;
84 void setCurrentScale(float scale);
86 FloatPoint currentTranslate() const;
88 TimeScheduler* timeScheduler() { return m_timeScheduler; }
90 void pauseAnimations();
91 void unpauseAnimations();
92 bool animationsPaused() const;
94 float getCurrentTime() const;
95 void setCurrentTime(float seconds);
97 unsigned long suspendRedraw(unsigned long max_wait_milliseconds);
98 void unsuspendRedraw(unsigned long suspend_handle_id, ExceptionCode&);
99 void unsuspendRedrawAll();
102 NodeList* getIntersectionList(const FloatRect&, SVGElement *referenceElement);
103 NodeList* getEnclosureList(const FloatRect&, SVGElement *referenceElement);
104 bool checkIntersection(SVGElement*, const FloatRect&);
105 bool checkEnclosure(SVGElement*, const FloatRect&);
108 static float createSVGNumber();
109 static SVGLength* createSVGLength();
110 static SVGAngle* createSVGAngle();
111 static FloatPoint createSVGPoint(const IntPoint &p = IntPoint());
112 static SVGMatrix* createSVGMatrix();
113 static FloatRect createSVGRect();
114 static SVGTransform* createSVGTransform();
115 static SVGTransform* createSVGTransformFromMatrix(SVGMatrix*);
117 virtual void parseMappedAttribute(MappedAttribute *attr);
119 // 'virtual SVGLocatable' functions
120 virtual SVGMatrix *getCTM() const;
121 virtual SVGMatrix *getScreenCTM() const;
123 virtual bool rendererIsNeeded(RenderStyle *style) { return StyledElement::rendererIsNeeded(style); }
124 virtual RenderObject* createRenderer(RenderArena *arena, RenderStyle *style);
126 virtual void insertedIntoDocument();
127 virtual void removedFromDocument();
129 // 'virtual SVGZoomAndPan functions
130 virtual void setZoomAndPan(unsigned short zoomAndPan);
132 virtual void attributeChanged(Attribute*, bool preserveDecls = false);
135 virtual const SVGElement* contextElement() const { return this; }
138 void addSVGWindowEventListner(const AtomicString& eventType, const Attribute* attr);
140 ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
141 ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGFitToViewBox, FloatRect, ViewBox, viewBox)
142 ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGFitToViewBox, SVGPreserveAspectRatio*, PreserveAspectRatio, preserveAspectRatio)
144 ANIMATED_PROPERTY_DECLARATIONS(SVGSVGElement, SVGLength*, RefPtr<SVGLength>, X, x)
145 ANIMATED_PROPERTY_DECLARATIONS(SVGSVGElement, SVGLength*, RefPtr<SVGLength>, Y, y)
146 ANIMATED_PROPERTY_DECLARATIONS(SVGSVGElement, SVGLength*, RefPtr<SVGLength>, Width, width)
147 ANIMATED_PROPERTY_DECLARATIONS(SVGSVGElement, SVGLength*, RefPtr<SVGLength>, Height, height)
149 bool m_useCurrentView;
150 TimeScheduler* m_timeScheduler;
153 } // namespace WebCore
155 #endif // SVG_SUPPORT