InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IM2MMessageListener.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: dwaterfa
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // ADOBE CONFIDENTIAL
16 //
17 // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
18 //
19 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
20 // with the terms of the Adobe license agreement accompanying it. If you have received
21 // this file from a source other than Adobe, then your use, modification, or
22 // distribution of it requires the prior written permission of Adobe.
23 //
24 //========================================================================================
25 
26 #ifndef __IM2MMessageListener__
27 #define __IM2MMessageListener__
28 
29 #include "IPMUnknown.h"
30 
31 #include "AppFrameworkID.h"
32 #include "OMTypes.h"
33 
34 class IClassInfo;
35 class IPMStream;
36 class IHierarchy;
37 
38 
39 //
40 // AdobePatentID="P866" (dwaterfa 10/15/08)
41 //
42 
104 {
105 public:
106  enum { kDefaultIID = IID_IM2MMESSAGELISTENER };
107 
113  virtual void GetMessagesFor(const IClassInfo* cInfo,
114  const PMIID*& targetM,
115  uint32& targetMSize,
116  const PMIID*& ancestorM,
117  uint32& ancestorMSize,
118  const PMIID*& descendentM,
119  uint32& descendentMSize,
120  const PMIID*& unrelatedM,
121  uint32& unrelatedMSize) const = 0;
122 
134  enum Relation {
140 
146 
150  kTarget = 0,
151 
157 
163 
169  };
170 
171  class PrivateData;
172  class ChangeData;
173 
178  {
179  public:
185  virtual IDataBase* GetDataBase() const = 0;
186 
192  virtual const IPMUnknown* GetTarget() const = 0;
193 
199  virtual UIDRef GetTargetRef() const = 0;
200 
206  virtual ClassID GetTargetClassID() const = 0;
207 
212  virtual const ChangeData& GetChange() const = 0;
213 
223  virtual bool16 GetFromPreChange() const = 0;
224 
243  virtual bool16 GetIsDuplicateChange() const = 0;
244 
262  virtual bool16 GetWasDeferred() const = 0;
263 
276  virtual void AddPrivateData(PrivateData* data) = 0;
277 
283  virtual void DeferMessageToEnd() = 0;
284 
290  virtual void Forward(const IPMUnknown* newTargetBoss,
291  Relation relationToTarget) = 0;
292 
301  virtual void ForwardAs(const IPMUnknown* newTargetBoss,
302  Relation relationToTarget,
303  PMIID overrideIID) = 0;
304 
314  virtual void Message(const IPMUnknown* targetBoss,
315  const IPMUnknown* originalTargetBoss,
316  Relation originalRelation,
317  PMIID iid) = 0;
318 
331  virtual bool16 ForwardToSpreadOf(IHierarchy* hier,
332  PMIID overrideIID = kInvalidInterfaceID) = 0;
333 
349  virtual bool16 ForwardToParentOf(IHierarchy* hier,
350  PMIID overrideIID = kInvalidInterfaceID) = 0;
351 
361  virtual bool16 ForwardToDescendentsOf(IHierarchy* hier,
362  PMIID overrideIID = kInvalidInterfaceID) = 0;
363 
364  protected:
366  MessageHelper();
368  ~MessageHelper();
369 
370  private:
374  MessageHelper& operator=(const MessageHelper&);
375 
376  };
377 
393  virtual void Message(MessageHelper& helper, PrivateData* data) = 0;
394 
408  virtual PrivateData* SnapshotRead(const UIDRef& targetRef,
409  IPMStream* inStream) = 0;
410 
441  {
442  public:
452  virtual ~PrivateData();
453 
461  virtual void SnapshotReadWrite(IPMStream* stream) = 0;
462 
467  {
468  public:
474  virtual IDataBase* GetDataBase() const = 0;
475 
481  virtual const IPMUnknown* GetTarget() const = 0;
482 
488  virtual UIDRef GetTargetRef() const = 0;
489 
495  virtual ClassID GetTargetClassID() const = 0;
496 
512  virtual bool16 GetFirstChange(ChangeData& data) const = 0;
513 
523  virtual bool16 GetNextChange(ChangeData& data) const = 0;
524 
548  virtual void Message(const IPMUnknown* targetBoss,
549  const IPMUnknown* origTargetBoss,
550  Relation originalRelation,
551  PMIID iid) = 0;
552 
553  protected:
555  ValidateHelper();
557  ~ValidateHelper();
558 
559  private:
561  ValidateHelper(const ValidateHelper& other);
563  ValidateHelper& operator=(const ValidateHelper& other);
564 
565  };
566 
571  virtual void Validate(ValidateHelper& helper) = 0;
572 
598  virtual void Abandon(bool16 wasValidated) = 0;
599 
600 
601  protected:
603  PrivateData();
604 
605  private:
607  PrivateData(const PrivateData&);
609  PrivateData& operator=(const PrivateData&);
610 
611  };
612 
613 
618  {
619  public:
622  fOriginalTargetRef(),
623  fRelation(kTarget),
624  fIID(kInvalidInterfaceID)
625  { }
626 
633  ChangeData(const UIDRef& originalTargetRef,
634  Relation r, PMIID iid) :
635  fOriginalTargetRef(originalTargetRef),
636  fRelation(r),
637  fIID(iid)
638  { }
639 
640  const UIDRef& GetOriginalTargetRef() const
641  { return fOriginalTargetRef; }
642 
643  Relation GetOriginalRelation() const
644  { return fRelation; }
645 
646  bool16 GetOriginalWasAncestor() const
647  {
648  return ((fRelation == kHierAncestor) ||
649  (fRelation == kHierParent));
650  }
651 
652  bool16 GetOriginalWasParent() const
653  { return (fRelation == kHierParent); }
654 
655  bool16 GetOriginalWasTarget() const
656  { return (fRelation == kTarget); }
657 
658  bool16 GetOriginalWasChild() const
659  { return (fRelation == kHierChild); }
660 
661  bool16 GetOriginalWasDescendent() const
662  {
663  return ((fRelation == kHierDescendent) ||
664  (fRelation == kHierChild));
665  }
666 
667  bool16 GetOriginalWasUnrelated() const
668  { return (fRelation == kUnrelated); }
669 
670  PMIID GetIID() const
671  { return fIID; }
672 
673  private:
674  UIDRef fOriginalTargetRef;
675  Relation fRelation;
676  PMIID fIID;
677  };
678 
679 };
680 
681 #endif // __IM2MMessageListener__
682