2 Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
3 2004, 2005, 2006, 2007 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., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.
24 #include "SVGDocument.h"
27 /*#include "EventNames.h"
28 #include "ExceptionCode.h"
29 #include "FrameView.h"*/
30 #include "RenderView.h"
31 #include "SVGElement.h"
33 #include "SVGSVGElement.h"
34 /*#include "SVGViewSpec.h"
35 #include "SVGZoomEvent.h"
36 #include "SVGZoomAndPan.h"*/
40 SVGDocument::SVGDocument(DOMImplementation
* i
, Frame
* frame
)
45 SVGDocument::~SVGDocument()
49 SVGSVGElement
* SVGDocument::rootElement() const
51 Element
* elem
= documentElement();
52 if (elem
&& elem
->hasTagName(SVGNames::svgTag
))
53 return static_cast<SVGSVGElement
*>(elem
);
58 void SVGDocument::dispatchZoomEvent(float prevScale
, float newScale
)
60 /*ExceptionCode ec = 0;
61 RefPtr<SVGZoomEvent> event = static_pointer_cast<SVGZoomEvent>(createEvent("SVGZoomEvents", ec));
62 event->initEvent(EventNames::zoomEvent, true, false);
63 event->setPreviousScale(prevScale);
64 event->setNewScale(newScale);
65 rootElement()->dispatchEvent(event.release(), ec);*/
68 void SVGDocument::dispatchScrollEvent()
70 /*ExceptionCode ec = 0;
71 RefPtr<Event> event = createEvent("SVGEvents", ec);
72 event->initEvent(EventNames::scrollEvent, true, false);
73 rootElement()->dispatchEvent(event.release(), ec);*/
76 bool SVGDocument::zoomAndPanEnabled() const
78 /*if (rootElement()) {
79 if (rootElement()->useCurrentView()) {
80 if (rootElement()->currentView())
81 return rootElement()->currentView()->zoomAndPan() == SVGZoomAndPan::SVG_ZOOMANDPAN_MAGNIFY;
83 return rootElement()->zoomAndPan() == SVGZoomAndPan::SVG_ZOOMANDPAN_MAGNIFY;
89 void SVGDocument::startPan(const FloatPoint
& start
)
92 m_translate = FloatPoint(start.x() - rootElement()->currentTranslate().x(), rootElement()->currentTranslate().y() + start.y());*/
95 void SVGDocument::updatePan(const FloatPoint
& pos
) const
98 /*rootElement()->setCurrentTranslate(FloatPoint(pos.x() - m_translate.x(), m_translate.y() - pos.y()));
100 renderer()->repaint();*/
104 void SVGDocument::close()
106 bool doload
= !parsing() && m_tokenizer
;
108 DocumentImpl::close();
111 document()->dispatchWindowEvent(EventImpl::LOAD_EVENT
, false, false);
118 #endif // ENABLE(SVG)