Code

Fix Cairo export of masked objects.
[inkscape.git] / src / dom / domimpl.h
old mode 100755 (executable)
new mode 100644 (file)
index 677f5eb..dbf8175
@@ -46,9 +46,12 @@ namespace dom
 class DOMImplementationSourceImpl;
 class DOMImplementationImpl;
 class NodeImpl;
+typedef Ptr<NodeImpl> NodeImplPtr;
 class CharacterDataImpl;
 class AttrImpl;
+typedef Ptr<AttrImpl> AttrImplPtr;
 class ElementImpl;
+typedef Ptr<ElementImpl> ElementImplPtr;
 class TextImpl;
 class CommentImpl;
 class TypeInfoImpl;
@@ -59,12 +62,14 @@ class DOMLocatorImpl;
 class DOMConfigurationImpl;
 class CDATASectionImpl;
 class DocumentTypeImpl;
+typedef Ptr<DocumentTypeImpl> DocumentTypeImplPtr;
 class NotationImpl;
 class EntityImpl;
 class EntityReferenceImpl;
 class ProcessingInstructionImpl;
 class DocumentFragmentImpl;
 class DocumentImpl;
+typedef Ptr<DocumentImpl> DocumentImplPtr;
 
 
 
@@ -142,7 +147,7 @@ public:
     /**
      *
      */
-    virtual DocumentType *createDocumentType(const DOMString& qualifiedName,
+    virtual DocumentTypePtr createDocumentType(const DOMString& qualifiedName,
                                      const DOMString& publicId,
                                      const DOMString& systemId)
                                      throw(DOMException);
@@ -150,9 +155,9 @@ public:
     /**
      *
      */
-    virtual Document *createDocument(const DOMString& namespaceURI,
+    virtual DocumentPtr createDocument(const DOMString& namespaceURI,
                              const DOMString& qualifiedName,
-                             DocumentType *doctype)
+                             DocumentTypePtr doctype)
                              throw(DOMException);
     /**
      *
@@ -205,7 +210,7 @@ public:
     /**
      *
      */
-    virtual Node *getParentNode();
+    virtual NodePtr getParentNode();
 
     /**
      *
@@ -215,22 +220,22 @@ public:
     /**
      *
      */
-    virtual Node *getFirstChild();
+    virtual NodePtr getFirstChild();
 
     /**
      *
      */
-    virtual Node *getLastChild();
+    virtual NodePtr getLastChild();
 
     /**
      *
      */
-    virtual Node *getPreviousSibling();
+    virtual NodePtr getPreviousSibling();
 
     /**
      *
      */
-    virtual Node *getNextSibling();
+    virtual NodePtr getNextSibling();
 
     /**
      *
@@ -241,32 +246,32 @@ public:
     /**
      *
      */
-    virtual Document *getOwnerDocument();
+    virtual DocumentPtr getOwnerDocument();
 
     /**
      *
      */
-    virtual Node *insertBefore(const Node *newChild,
-                       const Node *refChild)
+    virtual NodePtr insertBefore(const NodePtr newChild,
+                       const NodePtr refChild)
                        throw(DOMException);
 
     /**
      *
      */
-    virtual Node *replaceChild(const Node *newChild,
-                       const Node *oldChild)
+    virtual NodePtr replaceChild(const NodePtr newChild,
+                       const NodePtr oldChild)
                        throw(DOMException);
 
     /**
      *
      */
-    virtual Node *removeChild(const Node *oldChild)
+    virtual NodePtr removeChild(const NodePtr oldChild)
                       throw(DOMException);
 
     /**
      *
      */
-    virtual Node *appendChild(const Node *newChild)
+    virtual NodePtr appendChild(const NodePtr newChild)
                       throw(DOMException);
 
     /**
@@ -277,7 +282,7 @@ public:
     /**
      *
      */
-    virtual Node *cloneNode(bool deep);
+    virtual NodePtr cloneNode(bool deep);
 
     /**
      *
@@ -323,18 +328,18 @@ public:
     /**
      *
      */
-    virtual unsigned short compareDocumentPosition(const Node *other);
+    virtual unsigned short compareDocumentPosition(const NodePtr other);
 
     /**
      *
      */
-    virtual DOMString getTextContext() throw(DOMException);
+    virtual DOMString getTextContent() throw(DOMException);
 
 
     /**
      *
      */
-    virtual void setTextContext(const DOMString &val) throw(DOMException);
+    virtual void setTextContent(const DOMString &val) throw(DOMException);
 
 
     /**
@@ -358,7 +363,7 @@ public:
     /**
      *
      */
-    virtual bool isEqualNode(const Node *node);
+    virtual bool isEqualNode(const NodePtr node);
 
 
 
@@ -379,7 +384,7 @@ public:
     /**
      *
      */
-    virtual DOMUserData *getUserData(const DOMString &namespaceURI);
+    virtual DOMUserData *getUserData(const DOMString &key);
 
 
     //##################
@@ -411,7 +416,7 @@ public:
             DOMString ret = iter->second;
             return ret;
             }
-        if (parent)
+        if (parent.get())
             {
             DOMString ret = parent->bindingsFind(prefix);
             if (ret.size() > 0)
@@ -434,7 +439,7 @@ public:
      *
      */
     DOMString lookupNamespacePrefix(const DOMString &namespaceURI,
-                                    Node *originalElement);
+                                    NodePtr originalElement);
     /**
      *
      */
@@ -443,17 +448,28 @@ public:
     /**
      *
      */
-    NodeImpl(DocumentImpl *owner);
+    NodeImpl(const NodeImpl &other);
 
     /**
      *
      */
-    NodeImpl(DocumentImpl *owner, const DOMString &nodeName);
+    NodeImpl &operator=(const NodeImpl &other);
 
     /**
      *
      */
-    NodeImpl(DocumentImpl *owner, const DOMString &namespaceURI, const DOMString &nodeName);
+    NodeImpl(DocumentImplPtr owner);
+
+    /**
+     *
+     */
+    NodeImpl(DocumentImplPtr owner, const DOMString &nodeName);
+
+    /**
+     *
+     */
+    NodeImpl(DocumentImplPtr owner, const DOMString &namespaceURI,
+                      const DOMString &nodeName);
 
     /**
      *
@@ -475,11 +491,11 @@ protected:
 
     unsigned short nodeType;
 
-    NodeImpl *parent;
+    NodeImplPtr parent;
 
-    NodeImpl *prev;
+    NodeImplPtr prev;
 
-    NodeImpl *next;
+    NodeImplPtr next;
 
     DOMUserData *userData;
 
@@ -495,10 +511,10 @@ protected:
 
     DOMString nodeValue;
 
-    NodeImpl *firstChild;
-    NodeImpl *lastChild;
+    NodeImplPtr firstChild;
+    NodeImplPtr lastChild;
 
-    DocumentImpl *ownerDocument;
+    DocumentImplPtr ownerDocument;
 
     NamedNodeMap attributes;
 
@@ -508,18 +524,19 @@ protected:
         UserDataEntry(const DOMString       &theKey,
                       const DOMUserData     *theData,
                       const UserDataHandler *theHandler)
-            {
+        {
             next    = NULL;
             key     = theKey;
             data    = (DOMUserData *)theData;
             handler = (UserDataHandler *)theHandler;
-            }
-        ~UserDataEntry()
-            {
+        }
+
+        virtual ~UserDataEntry()
+        {
             //delete anything after me, too
             if (next)
                 delete next;
-            }
+        }
 
         UserDataEntry   *next;
         DOMString       key;
@@ -528,6 +545,8 @@ protected:
     };
 
     UserDataEntry *userDataEntries;
+    
+    TypeInfo typeInfo;
 
     //### Our prefix->namespaceURI bindings
 
@@ -612,7 +631,7 @@ public:
     /**
      *
      */
-    CharacterDataImpl(DocumentImpl *owner, const DOMString &value);
+    CharacterDataImpl(DocumentImplPtr owner, const DOMString &value);
 
     /**
      *
@@ -663,13 +682,13 @@ public:
     /**
      *
      */
-    virtual Element *getOwnerElement();
+    virtual ElementPtr getOwnerElement();
 
 
     /**
      *
      */
-    virtual TypeInfo *getSchemaTypeInfo();
+    virtual TypeInfo &getSchemaTypeInfo();
 
 
     /**
@@ -686,17 +705,18 @@ public:
     /**
      *
      */
-    virtual void setOwnerElement(const Element *elem);
+    virtual void setOwnerElement(const ElementPtr elem);
 
     /**
      *
      */
-    AttrImpl(DocumentImpl *owner, const DOMString &name);
+    AttrImpl(DocumentImplPtr owner, const DOMString &name);
 
     /**
      *
      */
-    AttrImpl(DocumentImpl *owner, const DOMString &namespaceURI, const DOMString &name);
+    AttrImpl(DocumentImplPtr owner, const DOMString &namespaceURI,
+                              const DOMString &name);
 
     /**
      *
@@ -706,7 +726,7 @@ public:
 protected:
 
 
-    Element *ownerElement;
+    ElementPtr ownerElement;
 
 
 };
@@ -752,18 +772,18 @@ public:
     /**
      *
      */
-    virtual Attr *getAttributeNode(const DOMString& name);
+    virtual AttrPtr getAttributeNode(const DOMString& name);
 
     /**
      *
      */
-    virtual Attr *setAttributeNode(Attr *newAttr)
+    virtual AttrPtr setAttributeNode(AttrPtr newAttr)
                           throw(DOMException);
 
     /**
      *
      */
-    virtual Attr *removeAttributeNode(Attr *oldAttr)
+    virtual AttrPtr removeAttributeNode(AttrPtr oldAttr)
                              throw(DOMException);
 
     /**
@@ -795,13 +815,13 @@ public:
     /**
      *
      */
-    virtual Attr *getAttributeNodeNS(const DOMString& namespaceURI,
+    virtual AttrPtr getAttributeNodeNS(const DOMString& namespaceURI,
                             const DOMString& localName);
 
     /**
      *
      */
-    virtual Attr *setAttributeNodeNS(Attr *newAttr)
+    virtual AttrPtr setAttributeNodeNS(AttrPtr newAttr)
                             throw(DOMException);
 
     /**
@@ -824,7 +844,7 @@ public:
     /**
      *
      */
-    virtual TypeInfo *getSchemaTypeInto();
+    virtual TypeInfo &getSchemaTypeInfo();
 
 
     /**
@@ -843,7 +863,7 @@ public:
     /**
      *
      */
-    virtual void setIdAttributeNode(const Attr *idAttr,
+    virtual void setIdAttributeNode(const AttrPtr idAttr,
                                     bool isId) throw (DOMException);
 
 
@@ -861,12 +881,13 @@ public:
     /**
      *
      */
-    ElementImpl(DocumentImpl *owner, const DOMString &tagName);
+    ElementImpl(DocumentImplPtr owner, const DOMString &tagName);
 
     /**
      *
      */
-    ElementImpl(DocumentImpl *owner, const DOMString &namespaceURI, const DOMString &tagName);
+    ElementImpl(DocumentImplPtr owner, const DOMString &namespaceURI,
+                      const DOMString &tagName);
 
     /**
      *
@@ -883,9 +904,10 @@ protected:
 friend class DocumentImpl;
 
     static void getElementsByTagNameRecursive(NodeList &list,
-                        const DOMString& name, Element *elem);
+                        const DOMString& name, ElementPtr elem);
     static void getElementsByTagNameNSRecursive(NodeList &list,
-             const DOMString& namespaceURI, const DOMString& tagName, Element *elem);
+             const DOMString& namespaceURI, const DOMString& tagName,
+                         ElementPtr elem);
 };
 
 
@@ -906,7 +928,7 @@ public:
     /**
      *
      */
-    virtual Text *splitText(unsigned long offset)
+    virtual TextPtr splitText(unsigned long offset)
                     throw(DOMException);
 
     /**
@@ -923,7 +945,7 @@ public:
     /**
      *
      */
-    virtual Text *replaceWholeText(const DOMString &content)
+    virtual TextPtr replaceWholeText(const DOMString &content)
                                  throw(DOMException);
 
     //##################
@@ -939,7 +961,7 @@ public:
     /**
      *
      */
-    TextImpl(DocumentImpl *owner, const DOMString &val);
+    TextImpl(DocumentImplPtr owner, const DOMString &val);
 
     /**
      *
@@ -975,7 +997,7 @@ public:
     /**
      *
      */
-    CommentImpl(DocumentImpl *owner, const DOMString &theValue);
+    CommentImpl(DocumentImplPtr owner, const DOMString &theValue);
 
     /**
      *
@@ -1061,8 +1083,8 @@ public:
     virtual  void handle(unsigned short operation,
                          const DOMString &key,
                          const DOMUserData *data,
-                         const Node *src,
-                         const Node *dst);
+                         const NodePtr src,
+                         const NodePtr dst);
 
     //##################
     //# Non-API methods
@@ -1228,7 +1250,7 @@ public:
     /**
      *
      */
-    virtual Node *getRelatedNode();
+    virtual NodePtr getRelatedNode();
 
 
     /**
@@ -1264,7 +1286,7 @@ protected:
 
     long utf16Offset;
 
-    Node *relatedNode;
+    NodePtr relatedNode;
 
     DOMString uri;
 };
@@ -1351,7 +1373,7 @@ public:
     /**
      *
      */
-    CDATASectionImpl(DocumentImpl *owner, const DOMString &value);
+    CDATASectionImpl(DocumentImplPtr owner, const DOMString &value);
 
     /**
      *
@@ -1473,7 +1495,7 @@ public:
     /**
      *
      */
-    NotationImpl(DocumentImpl *owner);
+    NotationImpl(DocumentImplPtr owner);
 
     /**
      *
@@ -1550,7 +1572,7 @@ public:
     /**
      *
      */
-    EntityImpl(DocumentImpl *owner);
+    EntityImpl(DocumentImplPtr owner);
 
     /**
      *
@@ -1602,7 +1624,7 @@ public:
     /**
      *
      */
-    EntityReferenceImpl(DocumentImpl *owner, const DOMString &theName);
+    EntityReferenceImpl(DocumentImplPtr owner, const DOMString &theName);
 
     /**
      *
@@ -1622,7 +1644,9 @@ public:
 /**
  *
  */
-class ProcessingInstructionImpl : public ProcessingInstruction, public NodeImpl
+class ProcessingInstructionImpl : 
+              public ProcessingInstruction,
+                         public NodeImpl
 {
 public:
 
@@ -1656,7 +1680,7 @@ public:
     /**
      *
      */
-    ProcessingInstructionImpl(DocumentImpl *owner,
+    ProcessingInstructionImpl(DocumentImplPtr owner,
                               const DOMString &target,
                               const DOMString &data);
 
@@ -1703,7 +1727,7 @@ public:
     /**
      *
      */
-    DocumentFragmentImpl(DocumentImpl *owner);
+    DocumentFragmentImpl(DocumentImplPtr owner);
 
     /**
      *
@@ -1731,7 +1755,7 @@ public:
     /**
      *
      */
-    virtual DocumentType *getDoctype();
+    virtual DocumentTypePtr getDoctype();
 
     /**
      *
@@ -1741,52 +1765,53 @@ public:
     /**
      *
      */
-    virtual Element *getDocumentElement();
+    virtual ElementPtr getDocumentElement();
 
     /**
      *
      */
-    virtual Element *createElement(const DOMString& tagName)
+    virtual ElementPtr createElement(const DOMString& tagName)
                            throw(DOMException);
 
     /**
      *
      */
-    virtual DocumentFragment *createDocumentFragment();
+    virtual DocumentFragmentPtr createDocumentFragment();
 
     /**
      *
      */
-    virtual Text *createTextNode(const DOMString& data);
+    virtual TextPtr createTextNode(const DOMString& data);
 
     /**
      *
      */
-    virtual Comment  *createComment(const DOMString& data);
+    virtual CommentPtr createComment(const DOMString& data);
 
     /**
      *
      */
-    virtual CDATASection *createCDATASection(const DOMString& data)
+    virtual CDATASectionPtr createCDATASection(const DOMString& data)
                                      throw(DOMException);
 
     /**
      *
      */
-    virtual ProcessingInstruction *createProcessingInstruction(const DOMString& target,
-                                                       const DOMString& data)
-                                                       throw(DOMException);
+    virtual ProcessingInstructionPtr createProcessingInstruction(
+                                       const DOMString& target,
+                                    const DOMString& data)
+                                    throw(DOMException);
 
     /**
      *
      */
-    virtual Attr *createAttribute(const DOMString& name)
+    virtual AttrPtr createAttribute(const DOMString& name)
                           throw(DOMException);
 
     /**
      *
      */
-    virtual EntityReference *createEntityReference(const DOMString& name)
+    virtual EntityReferencePtr createEntityReference(const DOMString& name)
                                            throw(DOMException);
 
     /**
@@ -1798,21 +1823,21 @@ public:
     /**
      *
      */
-    virtual Node *importNode(const Node *importedNode,
+    virtual NodePtr importNode(const NodePtr importedNode,
                      bool deep)
                      throw(DOMException);
 
     /**
      *
      */
-    virtual Element *createElementNS(const DOMString& namespaceURI,
+    virtual ElementPtr createElementNS(const DOMString& namespaceURI,
                              const DOMString& qualifiedName)
                              throw(DOMException);
 
     /**
      *
      */
-    virtual Attr *createAttributeNS(const DOMString& namespaceURI,
+    virtual AttrPtr createAttributeNS(const DOMString& namespaceURI,
                             const DOMString& qualifiedName)
                             throw(DOMException);
 
@@ -1825,7 +1850,7 @@ public:
     /**
      *
      */
-    virtual Element *getElementById(const DOMString& elementId);
+    virtual ElementPtr getElementById(const DOMString& elementId);
 
 
     /**
@@ -1883,7 +1908,7 @@ public:
     /**
      *
      */
-    virtual Node *adoptNode(const Node *source) throw (DOMException);
+    virtual NodePtr adoptNode(const NodePtr source) throw (DOMException);
 
     /**
      *
@@ -1898,7 +1923,7 @@ public:
     /**
      *
      */
-    virtual Node *renameNode(const Node *n,
+    virtual NodePtr renameNode(const NodePtr n,
                              const DOMString &name,
                              const DOMString &qualifiedName)
                              throw (DOMException);
@@ -1909,9 +1934,9 @@ public:
     //##################
 
     DocumentImpl(const DOMImplementation *domImpl,
-                 const DOMString    &namespaceURI,
-                 const DOMString    &qualifiedName,
-                 const DocumentType *doctype);
+                 const DOMString       &namespaceURI,
+                 const DOMString       &qualifiedName,
+                 const DocumentTypePtr doctype);
 
     virtual ~DocumentImpl();
 
@@ -1924,13 +1949,13 @@ protected:
 
     DOMImplementation *parent;
 
-    DOMString *documentURI;
+    DOMString documentURI;
 
     DOMString qualifiedName;
 
-    DocumentType *doctype;
+    DocumentTypePtr doctype;
 
-    ElementImpl *documentElement;
+    ElementImplPtr documentElement;
 
     class NamedElementItem
     {
@@ -1939,7 +1964,7 @@ protected:
         {
             next = NULL;
         }
-        NamedElementItem(const DOMString &nameArg, Element *elemArg)
+        NamedElementItem(const DOMString &nameArg, ElementPtr elemArg)
         {
             next = NULL;
             name = nameArg;
@@ -1952,7 +1977,7 @@ protected:
         }
         NamedElementItem *next;
         DOMString        name;
-        Element          *elem;
+        ElementPtr       elem;
     };
 
     NamedElementItem elementsById;