KHtml

SVGDocument.cpp
1 /*
2  Copyright (C) 2004, 2005 Nikolas Zimmermann <[email protected]>
3  2004, 2005, 2006, 2007 Rob Buis <[email protected]>
4 
5  This file is part of the KDE project
6 
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.
11 
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.
16 
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.
21 */
22 
23 #include "SVGDocument.h"
24 #if ENABLE(SVG)
25 
26 /*#include "EventNames.h"
27 #include "ExceptionCode.h"
28 #include "FrameView.h"*/
29 #include "RenderView.h"
30 #include "SVGElement.h"
31 #include "SVGNames.h"
32 #include "SVGSVGElement.h"
33 /*#include "SVGViewSpec.h"
34 #include "SVGZoomEvent.h"
35 #include "SVGZoomAndPan.h"*/
36 
37 namespace WebCore
38 {
39 
40 SVGDocument::SVGDocument(Frame *frame)
41  : Document(frame)
42 {
43 }
44 
45 SVGDocument::~SVGDocument()
46 {
47 }
48 
49 SVGSVGElement *SVGDocument::rootElement() const
50 {
51  Element *elem = documentElement();
52  if (elem && elem->hasTagName(SVGNames::svgTag)) {
53  return static_cast<SVGSVGElement *>(elem);
54  }
55 
56  return nullptr;
57 }
58 
59 void SVGDocument::dispatchZoomEvent(float prevScale, float newScale)
60 {
61  Q_UNUSED(prevScale);
62  Q_UNUSED(newScale);
63 
64  /*ExceptionCode ec = 0;
65  RefPtr<SVGZoomEvent> event = static_pointer_cast<SVGZoomEvent>(createEvent("SVGZoomEvents", ec));
66  event->initEvent(EventNames::zoomEvent, true, false);
67  event->setPreviousScale(prevScale);
68  event->setNewScale(newScale);
69  rootElement()->dispatchEvent(event.release(), ec);*/
70 }
71 
72 void SVGDocument::dispatchScrollEvent()
73 {
74  /*ExceptionCode ec = 0;
75  RefPtr<Event> event = createEvent("SVGEvents", ec);
76  event->initEvent(EventNames::scrollEvent, true, false);
77  rootElement()->dispatchEvent(event.release(), ec);*/
78 }
79 
80 bool SVGDocument::zoomAndPanEnabled() const
81 {
82  /*if (rootElement()) {
83  if (rootElement()->useCurrentView()) {
84  if (rootElement()->currentView())
85  return rootElement()->currentView()->zoomAndPan() == SVGZoomAndPan::SVG_ZOOMANDPAN_MAGNIFY;
86  } else
87  return rootElement()->zoomAndPan() == SVGZoomAndPan::SVG_ZOOMANDPAN_MAGNIFY;
88  }*/
89 
90  return false;
91 }
92 
93 void SVGDocument::startPan(const FloatPoint &start)
94 {
95  Q_UNUSED(start);
96  /*if (rootElement())
97  m_translate = FloatPoint(start.x() - rootElement()->currentTranslate().x(), rootElement()->currentTranslate().y() + start.y());*/
98 }
99 
100 void SVGDocument::updatePan(const FloatPoint &pos) const
101 {
102  Q_UNUSED(pos);
103  if (rootElement()) {
104  /*rootElement()->setCurrentTranslate(FloatPoint(pos.x() - m_translate.x(), m_translate.y() - pos.y()));
105  if (renderer())
106  renderer()->repaint();*/
107  }
108 }
109 
110 void SVGDocument::close()
111 {
112  bool doload = !parsing() && m_tokenizer;
113 
114  DocumentImpl::close();
115 
116  if (doload) {
117  document()->dispatchWindowEvent(DOM::EventImpl::LOAD_EVENT, false, false);
118  }
119 }
120 
121 }
122 
123 #endif // ENABLE(SVG)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Oct 16 2021 22:48:01 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.