InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IXPManager.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Matt Phillips
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 __IXPManager__
25 #define __IXPManager__
26 
27 #include "IPMUnknown.h"
28 #include "BravoForwardDecl.h"
29 #include "XPID.h"
30 
31 class IDocument;
32 class ICommand;
33 class PMRect;
34 class UIDList;
35 class IShape;
36 class IGraphicsPort;
37 
38 // For blur amounts less than kMinSuperSampleBlurSize, automatically multiply the
39 // ideal resolution by kSuperSampleMultiplier in order to avoid impression of jaggies.
40 const float kXPMinSuperSampleBlurSize = 0.5;
41 const float kXPSuperSampleMultiplier = 3.0;
42 
43 
44 class IXPManager : public IPMUnknown
45 {
46  public:
47  enum { kDefaultIID = IID_IXPMANAGER };
48 
49  // This is a helper function which gives you the AGMColorSpace corresponding to the
50  // current blending space preference in the document. Note that iPort is optional
51  // but that's primarily for backward compiler compatibility -- in general the port
52  // is needed so we can inspect the proofing configuration and make the appropriate
53  // profile available.
54  virtual AGMColorSpace* GetDocumentBlendingSpace(IGraphicsPort* iPort = nil) const = 0;
55  virtual void ReleaseBlendingSpace(AGMColorSpace*) const = 0;
56 
57  // Brute-force Transparency Search
58  // -------------------------------
59  // This is an expensive operation because it actually iterates over the content
60  // of the spread, including its masters. boundsRect is useful if you want to know,
61  // for example, whether a given page has transparency. iterateFlags controls the
62  // draw manager iteration used to search the page, so for example setting it to
63  // IShape:: kSkipHiddenLayers will cause the method to ignore transparency on
64  // hidden layers.
65 
66  virtual bool32 SpreadContainsTransparency(UID spreadRef, const PMRect& boundsRectInSpreadCoordinates,
67  int32 iterateFlags = 0) = 0;
68 
69  // Returns 1 or 0. The two later parameters allow an ITerateDrawOrder to call this, and then
70  // internally to continue using the same parameters.
71  virtual int32 ItemHasTransparency_(IShape* item, const PMMatrix* transform, int32 nFlags) = 0;
72 
73  // Check if a particular IShape item has transparency.
74  int32 ItemHasTransparency(IShape* item)
75  {
76  return ItemHasTransparency_( item, nil, 0);
77  }
78 
79  // Page-Items-With-Transparency List
80  // ---------------------------------
81  // The XPManager maintains a list of all page items in the document which have
82  // transparency. This is used for a number of purposes, but mainly for determining
83  // whether there's XP in the document, and for transparency usage.
84 
85  virtual int32 GetNumItemsWithXP() const = 0;
86  virtual UID GetNthItemWithXP(int32 n) const = 0;
87  virtual int32 GetItemIndex(UID uid) const = 0;
88 
89  // These are called whenever you affect the presence of transparency on an item. In
90  // response, the XPManager will ask the item(s) for their new XP state, and if it changes,
91  // will update the list of items in the doc containing XP. See also XPItemXPChangedCmd.
92 
93  // XPChangeType is used to tell ItemXPChanged what happened.
94  enum XPChangeType
95  {
96  kXPC_AddedSomeXP, // An XP attribute/setting was added/enabled
97  kXPC_RemovedSomeXP, // An XP attribute/setting was removed/disabled
98  kXPC_AddedItemWithXP, // Added a new item that has transparency.
99  kXPC_ItemRemoved, // The item is being deleted (remove from itemlist).
100  kXPC_ItemMoved, // The item was moved or resized (if on a master, could affect
101  // the XP state of the spreads using that master)
102  kXPC_NoChange, // Only used as a no-op case.
103  kXPC_MayHaveAddedSomeXP // Settings were changed; unclear if result was to add transparency
104  };
105  virtual void ItemXPChanged(UID itemUID, XPChangeType chg) = 0;
106  virtual void ItemXPChanged(const UIDList& itemList, XPChangeType chg) = 0;
107 
108  // Utility version of above which builds and processes an XPItemXPChangedCmd.
109  virtual ErrorCode ProcessItemXPChangedCmd(const UIDList& itemList, XPChangeType chg) = 0;
110 
111  // Spread-Has-Transparency Cache
112  // -----------------------------
113  // Maintains a per-spread cache of presence of transparency. Info is maintained solely on
114  // the presence of transparent items on spread, not based on location; so, if you want to know
115  // if a *page* has transparency, you have to use one of the search-based methods above.
116  // Note that the cache is NOT persistent.
117 
118  // Returns 1 or 0, unless autoValidate is false, in which case can also return -1 if state not known.
119  virtual int32 SpreadHasTransparency(UID spreadUID, bool32 autoValidate = kTrue) = 0;
120 
121  // Cache invalidation
122  virtual void InvalidateSpreadHasXPCache() = 0; // entire cache
123  virtual void InvalidateSpreadHasXPCache(UID spreadUID) = 0; // just this spread
124  virtual void InvalidateSpreadHasXPCache(const UIDList& spreadList) = 0; // just these spreads
125 
126  // Adobe internal use only
127  virtual void ConvertPhase2(int32 privatePhase2Code) = 0;
128 
129  // Check if a particular item itself or any item in its parent hierarchy has transparency.
130  virtual int32 ItemHasTransparencyInParentHierarchy(IShape* item) = 0;
131 
132 };
133 
134 #endif