InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
XMLTreeLazyNotificationData.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Ryan Gano
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 __XMLLazyTreeMsgCookie__
25 #define __XMLLazyTreeMsgCookie__
26 
27 #include "TreeLazyNotificationData.h"
28 #include "IIDXMLElement.h"
29 
35 {
36 public:
38  {
39  }
40 
42  {
43  }
44 
45 private:
46  virtual TreeLazyNotificationData<XMLReference> *CreateNewCookie() const
47  { return new XMLTreeLazyNotificationData; }
48 
49  virtual bool16 GetParent(const XMLReference &xmlRef, XMLReference &parentXMLRef) const
50  {
51  bool16 bFoundParent(kFalse);
52 
53  if (xmlRef != kInvalidXMLReference)
54  {
55  InterfacePtr<IIDXMLElement> element(xmlRef.Instantiate());
56  if (element)
57  {
58  parentXMLRef = element->GetParent();
59 
60  if (parentXMLRef != kInvalidXMLReference)
61  bFoundParent = kTrue;
62  }
63  }
64  else
65  {
66  parentXMLRef = xmlRef;
67  ASSERT_FAIL("Why am I getting passed an invalid reference? This will probably hang in release.");
68  }
69 
70  return bFoundParent;
71  }
72 
73 #ifdef DEBUG
74  virtual PMString GetNodeName(const XMLReference &xmlRef) const
75  {
76  PMString retVal;
77 
78  InterfacePtr<IIDXMLElement> element(xmlRef.Instantiate());
79  if (element)
80  {
81  retVal = element->GetTagString();
82  retVal.Append(" - ");
83  }
84 
85  retVal.Append("[");
86  retVal.AppendNumber(xmlRef.GetUID().Get());
87  retVal.Append(",");
88  retVal.AppendNumber(xmlRef.GetLogicalID());
89  retVal.Append("]");
90 
91  return retVal;
92  }
93 #endif
94 };
95 
96 #endif