InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
CShape.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Jack Kirstein
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 // RESTRICTED FILE
24 //
25 //========================================================================================
26 
27 #ifndef __CShape__
28 #define __CShape__
29 
30 #include "IShape.h"
31 #include "IAdornmentShape.h"
32 #include "PMMatrix.h"
33 #include "TransformTypes.h"
34 #include "HelperInterface.h"
35 
36 class IViewPort;
37 class IGraphicsPort;
38 class ICallback;
39 class IPageItemCache;
40 class IHierarchy;
41 class IGeometry;
42 class IHandleShape;
44 
45 
46 class CShape : public IShape
47 {
48  public:
49 
50  CShape(IPMUnknown *boss);
51  virtual ~CShape();
52 
53  // CShape provides a default implementation for ProcessDrawShape that sends out draw events
54  // (kDrawShapeMessage, kBeginShapeMessage, kEndShapeMessage), sets XOR or not
55  // and then calls either DrawShape. In general, shapes should
56  // override DrawShape but not ProcessDrawShape.
57  virtual void ProcessDrawShape(GraphicsData* gd, int32 flags);
58 
59  // This method grabs the geometry and transforms the boundingbox into device space
60  // then returns the result.
61  virtual PMRect GetPaintedBBox(const PMMatrix& theMatrix, const Transform::CoordinateSpace& coordinateSpace);
62 
63  // return the bbox of the item + printing adornments
64  virtual PMRect GetPrintedBBox(const PMMatrix& theMatrix, const Transform::CoordinateSpace& coordinateSpace, bool32 includeAdornments = kTrue);
65 
66  // call callbackInfo->callback for each item in this shape's hierarchy
67  virtual void IterateShapeDrawOrder_(const PMMatrix *xform, ICallback *callbackInfo, int32 flags);
68 
69  // The CShape implementation simply invals the result of GetPaintedBBox.
70  virtual void Inval(GraphicsData* gd, ClassID reasonForInval, int32 flags);
71 
72  protected:
73  // If you want your shape to do anything, override DrawShape. The default draws
74  // an Xbox that fits the bbox returned from IGeometry.
75  virtual void DrawShape(GraphicsData* gd, int32 flags);
76 
77  // A helper method provided for those CShape decendents that are part of
78  // objects having children. DrawHierarchy iterates over the children shapes
79  // and calls draw. The default implementations of Draw and DrawShape do not
80  // call DrawHierarchy.
81  virtual void DrawHierarchy(GraphicsData* gd, int32 flags);
82 
83  // Another helper methods for those objects that have children.
84  virtual void IterateDrawOrderHierarchy(const PMMatrix *xform, ICallback *callbackInfo, int32 flags);
85 
86 
87 
88  // boolean checks
89  virtual bool16 IsDynamic(int32 flags);
90  virtual bool16 IsPatientUser(int32 flags);
91  virtual bool16 IsPrinting(int32 flags);
92  virtual bool16 ShapeDisabled (GraphicsData *gd, int32 flags);
93 
94  //Draws the specified page item adornments
95  virtual void DrawPageItemAdornments( GraphicsData *, int32,
96  IAdornmentShape::AdornmentDrawOrder);
97  virtual void UnionPageItemAdornmentPaintedBBox(PMRect &, const PMMatrix& innertoview);
98  virtual void UnionPrintingPageItemAdornmentPaintedBBox(PMRect &, const PMMatrix& innertoview);
99 
100  virtual void InvalPageItemAdornments (IAdornmentShape::AdornmentDrawOrder, GraphicsData* gd, ClassID reasonForInval, int32 flags);
101 
102  bool16 IsCacheValid() const;
103 
104  IDataBase *fDB;
105 
106  IPageItemCache* fPageItemCache;
107 
108  // The following interfaces are cached for performance reasons.
109  // Note not all objects have a path handle shape
110  IHierarchy* fHierarchy;
111  IGeometry* fGeometry;
112  IHandleShape* fHandleShape;
113  IHandleShape* fPathHandleShape;
114  IPageItemAdornmentList* fAdornmentList;
115 
116 
117 };
118 
119 
120 #endif