InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ILayerUtils.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Paul Sorrick
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 // Purpose:
24 // Utilities for use for dealing with layers.
25 //
26 //========================================================================================
27 
28 #ifndef __ILayerUtils__
29 #define __ILayerUtils__
30 
31 #include "Utils.h"
32 #include "LayerID.h"
33 
34 class UIDList;
35 class ICommand;
36 class IControlView;
37 class IDocument;
38 class IDocumentLayer;
39 class IHierarchy;
40 class ILayerList;
41 class ILayoutControlData;
42 class IScriptRequestData;
43 class ISpread;
44 class ISpreadLayer;
45 
46 typedef int32 LayerFlags; // Used for return value for IsLayerUsed
47 
48 /* Simple#defines (looking for only one attribute) involving CountLayers
49  Usage is Utils<ILayerUtils>()->CountUILayers(layerList);
50  */
51 #define CountLockedLayers(layerList) CountLayers(layerList, ILayerUtils::kFlagOn)
52 #define CountVisibleLayers(layerList) CountLayers(layerList, ILayerUtils::kDontCare, ILayerUtils::kFlagOn)
53 #define CountLockedGuideLayers(layerList) CountLayers(layerList, ILayerUtils::kDontCare, ILayerUtils::kDontCare, ILayerUtils::kFlagOn)
54 #define CountVisibleGuideLayers(layerList) CountLayers(layerList, ILayerUtils::kDontCare, ILayerUtils::kDontCare, ILayerUtils::kDontCare, ILayerUtils::kFlagOn)
55 #define CountUILayers(layerList) CountLayers(layerList, ILayerUtils::kDontCare, ILayerUtils::kDontCare, ILayerUtils::kDontCare, ILayerUtils::kDontCare, ILayerUtils::kFlagOn)
56 #define CountExpendableLayers(layerList) CountLayers(layerList, ILayerUtils::kDontCare, ILayerUtils::kDontCare, ILayerUtils::kDontCare, ILayerUtils::kDontCare, ILayerUtils::kDontCare, ILayerUtils::kFlagOn)
57 #define CountColoredLayers(layerList, uid) CountLayers(layerList, ILayerUtils::kDontCare, ILayerUtils::kDontCare, ILayerUtils::kDontCare, ILayerUtils::kDontCare, ILayerUtils::kDontCare, ILayerUtils::kDontCare, uid)
58 
59 /* More complex#defines, looking for a combination of attributes:
60  Usage is Utils<ILayerUtils>()->CountUILayers(layerList);
61  */
62 #define CountExpendableUILayers(layerList) CountLayers(layerList, ILayerUtils::kDontCare, ILayerUtils::kDontCare, ILayerUtils::kDontCare, ILayerUtils::kDontCare, ILayerUtils::kFlagOn, ILayerUtils::kFlagOn)
63 #define CountLockedUILayers(layerList) CountLayers(layerList, ILayerUtils::kFlagOn, ILayerUtils::kDontCare, ILayerUtils::kDontCare, ILayerUtils::kDontCare, ILayerUtils::kFlagOn)
64 #define CountVisibleUILayers(layerList) CountLayers(layerList, ILayerUtils::kDontCare, ILayerUtils::kFlagOn, ILayerUtils::kDontCare, ILayerUtils::kDontCare, ILayerUtils::kFlagOn)
65 
70 class ILayerUtils : public IPMUnknown
71 {
72  public:
73  enum { kDefaultIID = IID_ILAYERUTILS };
74 
77  enum CountLayersFlags { kFlagOff = ((int32)0), kFlagOn = ((int32)1), kDontCare = ((int32)0xFFFFFFFF) };
78 
79 
82  enum
83  {
84  kLayerNotUsed = 0x0000,
85  kLayerContainsArtwork = 0x0001,
86  kLayerContainsGuides = 0x0002,
87  kLayerHasPlaceGunOwnedItem = 0x0004,
88  kLayerContainsBoth = kLayerContainsArtwork | kLayerContainsGuides
89  };
90 
95  virtual LayerFlags IsLayerUsed(IDocumentLayer* docLayer) = 0;
96 
109  virtual int32 CountLayers(const ILayerList *layerList,
110  int32 isLocked = kDontCare,
111  int32 isVisible = kDontCare,
112  int32 isGuideLocked = kDontCare,
113  int32 isGuideVisible = kDontCare,
114  int32 isUILayer = kDontCare,
115  int32 isExpendable = kDontCare,
116  UID colorUID = (UID)kDontCare) = 0;
117 
123  virtual bool16 AnyLayersHidden(IDocument* document, int32* numHidden = nil) = 0;
124 
130  virtual bool16 AnyLayersLocked(IDocument* document, int32* numLocked = nil) = 0;
131 
137  virtual bool16 AreLayersUnlockedAndVisible(const UIDList* pageItems) = 0;
138 
144  virtual bool16 IsActiveLayerUnlockedAndVisible(const ILayoutControlData* layoutData) = 0;
145 
151  virtual ICommand* MakeUnlockShowLayerCmd(IControlView *controlView, IDocumentLayer* docLayer = nil) = 0;
152 
157  virtual UID GetLayerUID(const IHierarchy *theItem) = 0;
158 
163  virtual IDocumentLayer* QueryDocumentActiveLayer(const IDocument* document) = 0;
164 
172  virtual ErrorCode GetDestinationLayers( IScriptRequestData* data, ISpread* spread, K2Vector< InterfacePtr<ISpreadLayer> >& destinationLayerList ) = 0;
173 };
174 
175 #endif // __ILayerUtils__