InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IDOMElement.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Steve Pellegrin
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
16 //
17 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
18 // with the terms of the Adobe license agreement accompanying it. If you have received
19 // this file from a source other than Adobe, then your use, modification, or
20 // distribution of it requires the prior written permission of Adobe.
21 //
22 //========================================================================================
23 
24 #ifndef __IDOMElement_h__
25 #define __IDOMElement_h__
26 
27 // Adobe Patent or Adobe Patent Pending Invention Included Within this File
28 // Adobe patent application tracking B234, entitled Method and apparatus for formatting portion of content, inventors: Craig Rainwater, Steve Pellegrin, Robin Briggs
29 
30 // ----- Interfaces -----
31 
32 #include "IPMUnknown.h"
33 
34 // ----- Includes -----
35 
36 #include "K2Vector.h"
37 #include "KeyValuePair.h"
38 #include <adobe/vector.hpp>
39 
40 // ----- ID.h files -----
41 
42 #include "INXCoreID.h"
43 
44 class WideString;
45 class DOMAttributeValue;
46 
63 #define kInvalidDOMElementID ((IDOMElement::DOMElementID)kInvalidScriptID)
64 #define kInvalidDOMAttributeID ((IDOMElement::DOMAttributeID)kInvalidScriptID)
65 
66 #define kSelfAttributeID ((IDOMElement::DOMAttributeID)'Self')
67 #define kSelfAttributeName IDOMElement::DOMElementName(L"Self")
68 
69 #define kPICharAttributeName IDOMElement::DOMElementName(L"Char")
70 
71 class IDOMElement : public IPMUnknown
72 {
73 public:
74  typedef object_type data_type;
75 
76  enum { kDefaultIID = IID_IDOMELEMENT };
77 
78  typedef ScriptID DOMElementID;
79  typedef WideString DOMElementName;
80  typedef ScriptID DOMAttributeID;
85  typedef adobe::vector<AttributeIDValuePair> AttributeList;
87 
88  typedef enum {kTextContent, kBreakContent, kNonContent} ContentType;
89 
90 public:
94  virtual void Reset() = 0;
95 
100  virtual DOMElementID GetElementID() const = 0;
101 
106  virtual DOMElementName GetElementName() const = 0;
107 
112  virtual bool16 IsSameElement(IDOMElement *other) const = 0;
113 
118  virtual IDOMElement * QueryParent() const = 0;
119 
125  virtual bool16 HasAttribute(const DOMAttributeID id) = 0;
126 
132  virtual bool16 IsAttributeReadOnly(const DOMAttributeID id) = 0;
133 
139  virtual int32 GetAttributeIDs(AttributeIDList &ids) = 0;
140 
147  virtual bool16 GetAttribute(const DOMAttributeID id, DOMAttributeValue &value) = 0;
148 
155  virtual int32 GetMultipleAttributes(const AttributeIDList & idList, AttributeList & attributes) = 0;
156 
162  virtual int32 GetAttributes(AttributeList &attributes) = 0;
163 
170  virtual bool16 SetAttribute(const DOMAttributeID id, const DOMAttributeValue &value) = 0;
171 
177  virtual bool16 SetAttributes(const AttributeList &attributes) = 0;
178 
185  virtual int32 GetChildElements(ElementList &children) = 0;
186 
195  virtual int32 GetSpecificChildElements(DOMElementID childType, ElementList &children, bool includeSubtypes = kFalse) = 0;
196 
203  virtual IDOMElement * CreateChildElement(DOMElementID type, const AttributeList &attributes) = 0;
204 
210  virtual bool16 DeleteChildElement(IDOMElement *child) = 0;
211 
217  virtual bool16 DeleteChildElements(const ElementList &children) = 0;
218 
225  virtual void SetDontDiscoverResource(bool16 flag) = 0;
226 
231  virtual bool16 GetDontDiscoverResource() const = 0;
232 
238  virtual bool16 AddChildElement(IDOMElement * child) = 0;
239 
245  virtual bool16 RemoveChildElement(IDOMElement * child) = 0;
246 
253  virtual bool16 AddAttribute(const DOMAttributeID id, const DOMAttributeValue &value) = 0;
254 
260  virtual bool16 RemoveAttribute(const DOMAttributeID id) = 0;
261 
269  virtual bool16 InitializeAttributes(const IDOMElement::AttributeList &attributes, bool16 checkForSpecialObjects = kTrue) = 0;
270 
275  virtual bool16 HasContentChildren() = 0;
276 
282  virtual void AddContent(ContentType type, WideString& content) = 0;
283 
284 };
285 
286 #endif // __IDOMElement_h__