InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IGraphicStateDefinition.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Michael_Martz
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 _IGraphicStateDefinition_
25 #define _IGraphicStateDefinition_
26 //========================================================================================
27 //________________________________________________________________________________________
28 // INCLUDES
29 //________________________________________________________________________________________
30  #include "IPMUnknown.h"
31  #include "ShuksanID.h"
32 
33 //========================================================================================
34 //________________________________________________________________________________________
35 // CLASS DECLARATIONS
36 //________________________________________________________________________________________
37 class ICommand;
39 class GraphicSelectionTarget;
40 class UIDList;
42 class IWorkspace;
44 
50  {
51  //____________________________________________________________________________________
52  // Data Types
53  //____________________________________________________________________________________
54  public:
55  enum TargetType
56  {
57  kCurrentTarget = -1,
58  kDefaultTarget = 0,
59  kSelectionTarget,
60  kEyedropperTarget
61  };
62 
63  enum RenderingType
64  {
65  kNothing = 0,
66  kStroke,
67  kFill,
68  kBoth
69  };
70 
71  //____________________________________________________________________________________
72  // Attribute Utilities
73  //____________________________________________________________________________________
74  public:
75  virtual uint16 GetAttributeCount (ClassID, TargetType = kCurrentTarget) = 0;
76  virtual int16 GetAttributeValueCount (ClassID, uint32 whichAttribute, TargetType) = 0;
77 
78  virtual ErrorCode AddAttribute (IPMUnknown*, ICommand*, TargetType) = 0;
79  virtual ErrorCode CopyIntoAttribute (uint32, IPMUnknown*, ICommand*, TargetType) = 0;
80  virtual ErrorCode RemoveAttribute (ClassID, ICommand*, TargetType) = 0;
81 
82  virtual IPMUnknown* QueryAttribute (uint32, ClassID, const PMIID& = IID_IUNKNOWN, TargetType = kCurrentTarget) = 0;
83  virtual IPMUnknown* CreateAttributeCopy (uint32, ClassID, const PMIID& = IID_IUNKNOWN, TargetType = kCurrentTarget) = 0;
84 
85  virtual ErrorCode SwapStrokeAndFill (ICommand*, TargetType) = 0;
86  //____________________________________________________________________________________
87  // Meta Data Utilities
88  //____________________________________________________________________________________
89  public:
90  virtual ErrorCode Initialize (IWorkspace*) = 0;
91  virtual ErrorCode RegisterMetaDataObject (IDataBase*, ClassID, IPMUnknown*) = 0;
92  virtual ErrorCode InitializeRenderObjects (IGraphicStateRenderObjects*) = 0;
93 
94  // The following two methods update data in the graphic definition
95  virtual ErrorCode ChangeFillMetaDataObject (ClassID, IPMUnknown*, TargetType) = 0;
96  virtual ErrorCode ChangeStrokeMetaDataObject (ClassID, IPMUnknown*, TargetType) = 0;
97 
98  // The following three methods are for INTERNAL USE ONLY
99  virtual ErrorCode UpdateFillMetaDataObject (ClassID, IPMUnknown*, TargetType) = 0;
100  virtual ErrorCode UpdateStrokeMetaDataObject (ClassID, IPMUnknown*, TargetType) = 0;
101  virtual void UpdateRenderObjectsToProxyState (void) = 0;
102 
103  virtual IPMUnknown* CreateFillMetaDataCopy (ClassID, TargetType) = 0;
104  virtual IPMUnknown* CreateStrokeMetaDataCopy (ClassID, TargetType) = 0;
105 
106  virtual IPMUnknown* QueryFillMetaData (ClassID, TargetType) = 0;
107  virtual IPMUnknown* QueryStrokeMetaData (ClassID, TargetType) = 0;
108 
109  virtual void CreateDefaultStrokeAndFillMetaDataCopy (IPMUnknown**, IPMUnknown**) = 0;
110 
111  virtual void InitializeDefaultFillMetaData (IPMUnknown*,ClassID) = 0;
112  virtual void InitializeDefaultStrokeMetaData (IPMUnknown*,ClassID) = 0;
113 
114  //................................................................................
115  // Replace selection/default meta data within the graphic state whose meta data
116  // is dependent on the data contained by the rendering object specified by UID.
117  // It is assumed that this member function is called within a transaction and
118  // that the caller is responsible for undo and redo. None and multiple meta
119  // data objects are not searched. Returns what was actually replaced.
120  //................................................................................
121  virtual void ReplaceDefaultMetaData (UID uidToReplace, IPMUnknown *newMetaData, ClassID renderingObjectClass, GfxStateReplacementData*) = 0;
122  virtual void ReplaceSelectionMetaData (UID uidToReplace, IPMUnknown *newMetaData, ClassID renderingObjectClass, GfxStateReplacementData*) = 0;
123 
124  //................................................................................
125  // Replace selection/default meta data within the graphic state whose UID equals
126  // "uidToReplace" with the meta data provided. It is assumed that this
127  // member function is called within a transaction and that the caller is
128  // responsible for undo and redo. None and multiple meta data objects are
129  // not searched. Returns what was actually replaced.
130  //................................................................................
131  virtual void ReplaceDefaultMetaData (GfxStateReplacementData *original, GfxStateReplacementData *newData) = 0;
132  virtual void ReplaceSelectionMetaData (GfxStateReplacementData *original, GfxStateReplacementData *newData) = 0;
133 
134  //................................................................................
135  // If the content of a rendering object has changed outside of the graphic
136  // state, use this member function to force the graphic state to regenerate
137  // its meta data based on the current set of attributes. Works on the
138  // selection defintion only.
139  //................................................................................
140  virtual ErrorCode SyncMetaDataObjectsWithAttributes (RenderingType) = 0;
141 
142 
143  //____________________________________________________________________________________
144  // Default/Selection (Target) Utilities
145  //____________________________________________________________________________________
146  public:
147  virtual void ApplyMetaDataToSelection (ClassID, IPMUnknown*, ClassID) = 0;
148  virtual ClassID GetCurrentRenderObjectClass (void) const = 0;
149 
150  virtual ClassID GetFillClass (TargetType) = 0;
151  virtual ClassID GetStrokeClass (TargetType) = 0;
152 
153  virtual void SetFillClass (TargetType, ClassID) = 0;
154  virtual void SetStrokeClass (TargetType, ClassID) = 0;
155 
156  virtual void SetCurrentTarget (TargetType) = 0;
157  virtual TargetType GetCurrentTarget (void) = 0;
158 
159  virtual GraphicSelectionTarget* GetSelectionTarget (void) = 0;
160  virtual void SelectionTargetChanged (ClassID) = 0;
161 
162  //................................................................................
163  // DESCR: Return a descriptor from the cache.
164  //
165  // NOTE: The descriptor should not be held onto. It may be changed or released with
166  // the next selection change. Clients should not modify it or its contents.
167  //
168  // RETURNS: iDescriptor or nil
169  //................................................................................
170  virtual const IGraphicStyleAttributeBossList* GetPageItemDescriptorFromCache (int32) = 0;
171 
172  virtual void EnabledAttributesHaveChanged (TargetType, K2Vector<ClassID>*) = 0;
173  virtual void EnabledRenderingTypesHaveChanged (TargetType, const K2Vector<ClassID>*, const K2Vector<ClassID>*) = 0;
174  virtual bool16 IsAttributeEnabled (ClassID) = 0;
175  virtual bool16 IsStrokeRenderTypeEnabled (ClassID) = 0;
176  virtual bool16 IsFillRenderTypeEnabled (ClassID) = 0;
177 
178  virtual void ApplyTargetAttributesToPageItems (TargetType, const UIDList&, ClassID*, uint16) = 0;
179  virtual ErrorCode RemoveAllAttributes (ICommand*, TargetType, ClassID*, uint16) = 0;
180 
181  virtual IGraphicStyleAttributeBossList* CreateAttributeListCopy (TargetType) = 0;
182  virtual ErrorCode SetTargetAttributeList (TargetType, IGraphicStyleAttributeBossList*, ICommand*) = 0;
183  virtual ErrorCode AddMultAttributes (IGraphicStyleAttributeBossList*, ICommand*, TargetType) = 0;
184 
185  //____________________________________________________________________________________
186  // Defaults
187  //____________________________________________________________________________________
188  public:
189  virtual ErrorCode AddGraphicDefaults (const UIDList*) = 0;
190  virtual ErrorCode AddTextFrameDefaults (const UIDList*) = 0;
191  virtual ErrorCode AddGraphicFrameDefaults (const UIDList*) = 0;
192  };
195  {
196  };
197 
200  {
201  public:
202  ClassID classID;
203  };
204 
207  {
208  public:
209  const K2Vector<ClassID>* disabledClasses;
210  };
211 
214  {
215  //____________________________________________________________________________________
216  // Data Types
217  //____________________________________________________________________________________
218  public:
219  enum MessageType
220  {
221  kMsg_AttributeChanged = 0, // An attribute was changed (GfxStateGenericDefnChangeMsg)
222  kMsg_AttributeAdded, // An attribute was added (GfxStateGenericDefnChangeMsg)
223  kMsg_AttributeRemoved, // An attribute was removed (GfxStateGenericDefnChangeMsg)
224  kMsg_DefinitionChanged, // The whole definition changed in one or more ways (nil)
225  kMsg_FillMetaDataChanged, // The fill meta data changed (GfxStateGenericDefnChangeMsg)
226  kMsg_StrokeMetaDataChanged, // The stroke meta data changed (GfxStateGenericDefnChangeMsg)
227  kCurrentFillChangedMsg, // The current fill rendering type has changed (GfxStateGenericDefnChangeMsg)
228  kCurrentStrokeChangedMsg, // The current stroke rendering type has changed (GfxStateGenericDefnChangeMsg)
229  kSwapStrokeAndFillMsg, // The fill and stroke have been swapped (nil)
230  kEnabledAttributesMsg, // The attribute which are enabled have changed (GfxStateEnabledDefnChangeMsg)
231  kEnabledFillRenderingTypesMsg, // The fill rendering types which are enabled have changed (GfxStateEnabledDefnChangeMsg)
232  kEnabledStrokeRenderingTypesMsg, // The stroke rendering types which are enabled have changed (GfxStateEnabledDefnChangeMsg)
233  kGraphicStateChangedChangeMsg // The graphic state object is changing (used to use a message of nil)
234  };
235 
236  //____________________________________________________________________________________
237  // Data Members
238  //____________________________________________________________________________________
239  MessageType type;
240  GfxStateAbstractDefnChangeMsg *message; // Value determined by "type"
241  IGraphicStateDefinition::TargetType target;
242  bool16 inCurrentTarget;
243  IGraphicStateDefinition *iGfxStateDefintion; // Gfx State sending the message
244 
245  ICommand* command; // deprecated, use information in "message"
246  ClassID classID; // deprecated, use information in "message"
247  };
248 
251  {
252  //____________________________________________________________________________________
253  // Data Members
254  //____________________________________________________________________________________
255  public:
256  IPMUnknown *iSolidColorFillMD;
257  IPMUnknown *iSolidColorStrokeMD;
258  IPMUnknown *iGradientFillMD;
259  IPMUnknown *iGradientStrokeMD;
260 
261  IPMUnknown *iSolidColorRObjMD;
262  IPMUnknown *iGradientRObjMD;
263  };
264 
265 #endif // _IGraphicStateDefinition_