From 47d455dd55be855e4cc691c32f687f723d9247ee Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegraphics@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- ksvg/impl/SVGEcma.h | 250 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 250 insertions(+) create mode 100644 ksvg/impl/SVGEcma.h (limited to 'ksvg/impl/SVGEcma.h') diff --git a/ksvg/impl/SVGEcma.h b/ksvg/impl/SVGEcma.h new file mode 100644 index 00000000..adf1ec85 --- /dev/null +++ b/ksvg/impl/SVGEcma.h @@ -0,0 +1,250 @@ +/* + Copyright (C) 2002-2003 KSVG Team + This file is part of the KDE project + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef SVGEcma_H +#define SVGEcma_H + +#include +#include +#include +#include + +#include "ksvg_lookup.h" + +namespace KSVG +{ + +// Access DOM::Node via js +class SVGDOMNodeBridge +{ +public: + SVGDOMNodeBridge(DOM::Node impl) : m_impl(impl) { KSVG_EMPTY_FLAGS } + virtual ~SVGDOMNodeBridge() { } + + DOM::Node impl() const { return m_impl; } + + KSVG_BASECLASS_GET + KSVG_PUT + + enum + { + // Properties + NodeName, NodeValue, NodeType, ParentNode, + ChildNodes, FirstChild, LastChild, PreviousSibling, + NextSibling, Attributes, NamespaceURI, Prefix, + LocalName, OwnerDocument, + // Functions + InsertBefore, ReplaceChild, RemoveChild, AppendChild, + HasAttributes, HasChildNodes, CloneNode, Normalize, + IsSupported, AddEventListener, RemoveEventListener, Contains, + GetNodeName, GetNodeValue, GetNodeType, GetParentNode, + GetChildNodes, GetFirstChild, GetLastChild, GetPreviousSibling, + GetNextSibling, GetAttributes, GetNamespaceURI, GetPrefix, + GetLocalName, GetOwnerDocument + }; + + KJS::Value getValueProperty(KJS::ExecState *exec, int token) const; + void putValueProperty(KJS::ExecState *exec, int token, const KJS::Value &value, int attr); + +private: + DOM::Node m_impl; +}; + +// Access DOM::Element via js +class SVGDOMElementBridge : public SVGDOMNodeBridge +{ +public: + SVGDOMElementBridge(DOM::Element impl) : SVGDOMNodeBridge(static_cast(impl)), m_impl(impl) { } + ~SVGDOMElementBridge() { } + + DOM::Element impl() const { return m_impl; } + + KSVG_GET + KSVG_FORWARDPUT + + enum + { + // Properties + TagName, + // Functions + GetAttribute, SetAttribute, RemoveAttribute, GetAttributeNode, + SetAttributeNode, RemoveAttributeNode, GetElementsByTagName, + GetAttributeNS, SetAttributeNS, RemoveAttributeNS, GetAttributeNodeNS, + SetAttributeNodeNS, GetElementsByTagNameNS, HasAttribute, HasAttributeNS + }; + + KJS::Value getValueProperty(KJS::ExecState *exec, int token) const; + +private: + DOM::Element m_impl; +}; + +// Access DOM::NodeList via js +class SVGDOMNodeListBridge +{ +public: + SVGDOMNodeListBridge(DOM::NodeList impl) : m_impl(impl) { } + ~SVGDOMNodeListBridge() { } + + DOM::NodeList impl() const { return m_impl; } + + KSVG_GET + + enum + { + // Properties + Length, + // Functions + GetLength, Item + }; + + KJS::Value getValueProperty(KJS::ExecState *exec, int token) const; + +private: + DOM::NodeList m_impl; +}; + +// Access DOM::CharacterData via js +class SVGDOMCharacterDataBridge : public SVGDOMNodeBridge +{ +public: + SVGDOMCharacterDataBridge(DOM::CharacterData impl) : SVGDOMNodeBridge(static_cast(impl)), m_impl(impl) { KSVG_EMPTY_FLAGS } + ~SVGDOMCharacterDataBridge() { } + + DOM::CharacterData impl() const { return m_impl; } + + KSVG_GET + KSVG_PUT + + enum + { + // Properties + Data, Length, + // Functions + GetData, SetData, GetLength, + SubstringData, AppendData, InsertData, DeleteData, ReplaceData + }; + + KJS::Value getValueProperty(KJS::ExecState *exec, int token) const; + void putValueProperty(KJS::ExecState *exec, int token, const KJS::Value &value, int attr); + +private: + DOM::CharacterData m_impl; +}; + +// Access DOM::Text via js +class SVGDOMTextBridge : public SVGDOMCharacterDataBridge +{ +public: + SVGDOMTextBridge(DOM::Text impl) : SVGDOMCharacterDataBridge(static_cast(impl)), m_impl(impl) { } + ~SVGDOMTextBridge() { } + + DOM::Text impl() const { return m_impl; } + + KSVG_GET + KSVG_FORWARDPUT + + enum + { + // Properties + Dummy, + // Functions + SplitText + }; + + KJS::Value getValueProperty(KJS::ExecState *exec, int token) const; + +private: + DOM::Text m_impl; +}; + +// Access DOM::DOMImplementation via js +class SVGDOMDOMImplementationBridge +{ +public: + SVGDOMDOMImplementationBridge(DOM::DOMImplementation impl) : m_impl(impl) { } + ~SVGDOMDOMImplementationBridge() { } + + DOM::DOMImplementation impl() const { return m_impl; } + + KSVG_GET + KSVG_FORWARDPUT + + enum + { + // Properties + Dummy, + // Functions + HasFeature + }; + + KJS::Value getValueProperty(KJS::ExecState *exec, int token) const; + +private: + DOM::DOMImplementation m_impl; +}; + +// Access DOM::DocumentFragment via js +class SVGDOMDocumentFragmentBridge : public SVGDOMNodeBridge +{ +public: + SVGDOMDocumentFragmentBridge(DOM::DocumentFragment impl) : SVGDOMNodeBridge(static_cast(impl)), m_impl(impl) { } + ~SVGDOMDocumentFragmentBridge() { } + + DOM::DocumentFragment impl() const { return m_impl; } + + KSVG_GET + KSVG_FORWARDPUT + + enum + { + // Properties + Dummy + }; + + KJS::Value getValueProperty(KJS::ExecState *exec, int token) const; + +private: + DOM::DocumentFragment m_impl; +}; + +} + +KSVG_DEFINE_PROTOTYPE(SVGDOMNodeBridgeProto) +KSVG_IMPLEMENT_PROTOFUNC(SVGDOMNodeBridgeProtoFunc, SVGDOMNodeBridge) + +KSVG_DEFINE_PROTOTYPE(SVGDOMElementBridgeProto) +KSVG_IMPLEMENT_PROTOFUNC(SVGDOMElementBridgeProtoFunc, SVGDOMElementBridge) + +KSVG_DEFINE_PROTOTYPE(SVGDOMNodeListBridgeProto) +KSVG_IMPLEMENT_PROTOFUNC(SVGDOMNodeListBridgeProtoFunc, SVGDOMNodeListBridge) + +KSVG_DEFINE_PROTOTYPE(SVGDOMCharacterDataBridgeProto) +KSVG_IMPLEMENT_PROTOFUNC(SVGDOMCharacterDataBridgeProtoFunc, SVGDOMCharacterDataBridge) + +KSVG_DEFINE_PROTOTYPE(SVGDOMTextBridgeProto) +KSVG_IMPLEMENT_PROTOFUNC(SVGDOMTextBridgeProtoFunc, SVGDOMTextBridge) + +KSVG_DEFINE_PROTOTYPE(SVGDOMDOMImplementationBridgeProto) +KSVG_IMPLEMENT_PROTOFUNC(SVGDOMDOMImplementationBridgeProtoFunc, SVGDOMDOMImplementationBridge) + +#endif + +// vim:ts=4:noet -- cgit v1.2.1