InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ISwatchUtils.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Bernd Paradies
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 __ISwatchUtils__
25 #define __ISwatchUtils__
26 
27 #include "AppFrameworkID.h"
28 #include "IPMUnknown.h"
29 #include "Utils.h"
30 
31 #include "IColorData.h"
32 #include "IInkData.h"
33 
34 #include "ColorSystemID.h"
35 #include "ShuksanID.h"
36 #include "GraphicTypes.h"
37 #include "PMString.h"
38 #include "K2Vector.h"
39 #include "UIDList.h"
40 
41 class IWorkspace;
42 class ISwatchList;
43 class PMReal;
44 class IDataBase;
45 class IRenderingObject;
46 
47 
51 {
52 public:
54  bBaseNameExists(0),
55  bInitializedIndices(0) {}
56 
57 public:
58  K2Vector<int32> vecIndices;
59  bool16 bBaseNameExists;
60  bool16 bInitializedIndices;
61 };
62 
67 class ISwatchUtils : public IPMUnknown
68 {
69 public:
70  enum { kDefaultIID = IID_ISWATCHUTILS };
71 
76  kNoMatch = -1,
81  };
82 
94  };
95 
99  enum ActionCode {
114  };
115 
116  // it might have been nice if all the various boolean duplicate parameters had originally
117  // been bitflags, but they weren't. So, I am starting a new set of bitflags
118 
121  enum SwatchFlags {
122  // just means none of the other flags are set.
123  kNoFlags = 0,
124 
129 
133 
136  kUnlockSwatch = (1L<<2),
137 
141 
145 
149 
150  };
151 
154  enum CompareCode {
173  };
174 
177  enum SwatchType {
207  };
208 
224  };
225 
237  virtual PMString GetUniqueSwatchName( ISwatchList* swatchList,
238  const PMString& baseName,
239  const PMString& suffixString,
240  bool16 doAppendSuffix = kTrue,
241  bool16 doTruncateNumber = kTrue,
242  SwatchUtilsUniqueNameTempCache* pCache = nil) = 0;
243 
253  virtual PMString FormatSwatchNameWithColorValue (ISwatchList* swatchList, int32 colorspace, const ColorArray& colorValue, bool16 doUseComma) = 0;
254 
261  virtual ISwatchList* QueryActiveSwatchList(IActiveContext* context = nil) = 0;
262 
268  virtual ISwatchList* QuerySwatchList(IDataBase* iDataBase) = 0;
269 
281  virtual UID CreateNewSwatch( ClassID renderClassID, const IPMUnknown* newRenderObject, IDataBase* iDataBase, bool16 updateGfxState = kTrue, int32 nSwatchFlags = kNoFlags, const UID& colorGroup = kInvalidUID) = 0;
282 
285  virtual UID CreateNewSwatch( ClassID renderClassID, const IPMUnknown* newRenderObject, IWorkspace* workspacePtr, bool16 updateGfxState = kTrue, int32 nSwatchFlags = kNoFlags, const UID& colorGroup = kInvalidUID) = 0;
286 
301  virtual UIDList DuplicateSwatches(
302  const UIDList& dupList,
303  ISwatchList* swatchList,
304  bool16 makeHidden,
305  bool16 convertToProcess,
306  bool16 doCheck,
308  const PMString& nameSuffixString = PMString(""),
309  bool16 doConvert = kFalse,
310  bool16 doUnlock = kFalse,
311  int32 nFlags = kNoFlags) = 0;
312 
318  virtual ErrorCode ReplaceAndDeleteSwatches( UIDList* selectedList, UID replacementUID ) = 0;
319 
324  virtual ErrorCode ConvertAndDeleteSwatches( UIDList* selectedList ) = 0;
325 
331  virtual bool16 ConvertToGlobalColorSwatch(ISwatchList* iSwatchList, const UID& originalUID, UID& newUID) = 0;
332 
339  virtual void GetAllDependentSwatches(ISwatchList* iSwatchList, const UIDList& fromList, UIDList& dependentList) = 0;
340 
347  virtual void GetAllDependentColorSwatchesAndTintValues(ISwatchList* iSwatchList, const UIDList& fromList, UIDList& dependentList, K2Vector<PMReal>& tintList) = 0;
348 
353  virtual void GetAllMixedInkParentSwatches (ISwatchList* iSwatchList, UIDList& mixedInkParentList) = 0;
354 
361  virtual void GetDependentMixedInkSwatches (ISwatchList* iSwatchList, const UIDRef& mixedInkParentRef, UIDList& mixedInkList) = 0;
362 
363  //___________________________________________________________________________________
364 
372  virtual UID CreateTintedSwatch
373  (
374  const UIDRef& srcSwatch,
375  const PMReal& tintval,
376  const UID& colorGroup = kInvalidUID
377  ) = 0;
378 
379 
391  (
392  IWorkspace* workspacePtr,
393  const PMString& swatchName,
394  const PMReal& cyanVal,
395  const PMReal& magentaVal,
396  const PMReal& yellowVal,
397  const PMReal& blackVal,
398  const UID& colorGroup = kInvalidUID
399  ) = 0;
400 
411  (
412  IWorkspace* workspacePtr,
413  const PMString& swatchName,
414  const PMReal& redVal,
415  const PMReal& greenVal,
416  const PMReal& blueVal,
417  const UID& colorGroup = kInvalidUID
418  ) = 0;
419 
430  (
431  IWorkspace* workspacePtr,
432  const PMString& swatchName,
433  const PMReal& LVal,
434  const PMReal& aVal,
435  const PMReal& bVal,
436  const UID& colorGroup = kInvalidUID
437  ) = 0;
438 
449  (
450  IWorkspace* workspacePtr,
451  const PMString& swatchName,
452  const PMReal& hueVal,
453  const PMReal& satVal,
454  const PMReal& briVal,
455  const UID& colorGroup = kInvalidUID
456  ) = 0;
467  virtual UID CreateSpotCMYKSwatch
468  (
469  IWorkspace* workspacePtr,
470  const PMString& swatchName,
471  const PMReal& cyanVal,
472  const PMReal& magentaVal,
473  const PMReal& yellowVal,
474  const PMReal& blackVal,
475  const UID& colorGroup = kInvalidUID
476  ) = 0;
477 
487  virtual UID CreateSpotRGBSwatch
488  (
489  IWorkspace* workspacePtr,
490  const PMString& swatchName,
491  const PMReal& redVal,
492  const PMReal& greenVal,
493  const PMReal& blueVal,
494  const UID& colorGroup = kInvalidUID
495  ) = 0;
496 
506  virtual UID CreateSpotLABSwatch
507  (
508  IWorkspace* workspacePtr,
509  const PMString& swatchName,
510  const PMReal& LVal,
511  const PMReal& aVal,
512  const PMReal& bVal,
513  const UID& colorGroup = kInvalidUID
514  ) = 0;
515 
525  virtual UID CreateSpotHSBSwatch
526  (
527  IWorkspace* workspacePtr,
528  const PMString& swatchName,
529  const PMReal& hueVal,
530  const PMReal& satVal,
531  const PMReal& briVal,
532  const UID& colorGroup = kInvalidUID
533  ) = 0;
534 
545  virtual ErrorCode ReplaceColorSwatchDefinition (const UIDRef& swatchRef1, const UIDRef& swatchRef2, int32 nFlags = kNoFlags) = 0;
546 
556  virtual ErrorCode ReplaceGradientSwatchDefinition(const UIDRef&, const UIDRef&) = 0;
557 
570  virtual bool16 SyncMixedInkSwatchesColorData (IDataBase* iSrcDB, IDataBase* iTargetDB, IRenderingObject* iSrcRenderObject, IRenderingObject* iTargetRenderObject, ColorArray& newComponents) = 0;
571 
572  //___________________________________________________________________________________
573 
581  virtual bool16 TintColorSwatchAlreadyExists( const UID& baseObjectUID, const PMReal& tint, ISwatchList* swatchList = nil, UIDRef* matchedRef = nil ) = 0;
582 
588  virtual bool16 SwatchIsGlobalSwatch (IDataBase* iDataBase, UID swatchUID) = 0;
589 
595  virtual bool16 SwatchIsVisible (IDataBase* iDataBase, UID swatchUID) = 0;
596 
602  virtual bool16 SwatchIsLocked (IDataBase*, UID) = 0;
603 
610  virtual UID GetSwatchAliasUID (IDataBase*, UID) = 0;
611 
617  virtual bool16 SwatchIsReservedSwatch (IDataBase*, UID) = 0;
618 
624  virtual bool16 SwatchIsSpotColorSwatch(const UIDRef& swatchRef) = 0;
625 
631  virtual bool16 SwatchIsBasedOnSwatch(const UIDRef& swatchRef) = 0;
632 
638  virtual bool16 SwatchIsTintSwatch(const UIDRef& swatchRef, UID* pBaseUID = nil) = 0;
639 
645  virtual bool16 SwatchIsMixedInkSwatch(const UIDRef& swatchRef, UID* pParentUID = nil) = 0;
646 
651  virtual bool16 SwatchIsMixedInkGroupParent(const UIDRef& swatchRef) = 0;
652 
658  virtual bool16 SpotSwatchIsConvertedToProcess(const UIDRef& swatchRef) = 0;
659 
667  virtual SwatchType GetSwatchType (const UIDRef& swatchRef, UID* pBaseUID = nil) = 0;
668 
673  virtual UID GetBaseObjectUIDFromSwatch(const UIDRef& swatchRef) = 0;
674 
679  virtual UID GetNoneSwatchUID ( IDataBase* iDataBase ) = 0;
680 
685  virtual UID GetBlackSwatchUID ( IDataBase* iDataBase ) = 0;
686 
691  virtual UID GetPaperSwatchUID ( IDataBase* iDataBase ) = 0;
692 
697  virtual UID GetRegistrationSwatchUID ( IDataBase* iDataBase ) = 0;
698 
705  virtual UID GetNamedSwatch(const PMString& swatchName, IDataBase* iDataBase = nil) = 0;
706 
712  virtual PMString GetSwatchName (IDataBase* iDataBase, UID swatchUID) = 0;
713 
719  virtual UIDList GetAllTintSwatchUIDListOfSwatch (IDataBase* iDataBase, UID swatchUID) = 0;
720 
721  //___________________________________________________________________________________
722 
733  virtual ISwatchUtils::ActionCode CheckSwatchBeforeCopy(const UIDRef& swatchRef, ISwatchList* swatchList, bool16 doAlertUser, ISwatchUtils::DuplicatePref dupPref, UIDRef& matchedRef, ISwatchUtils::CompareCode& resultCode) = 0;
734 
735  //___________________________________________________________________________________
736  // Following are utility functions that help deal with swatch conflict resolution.
737  //___________________________________________________________________________________
743  virtual void SynchronizeTintsOfAliasedSwatchOldAndNew (ISwatchList* iSwatchList, const UIDRef& swatchRef, UID newUID) = 0;
744 
750  virtual void SynchronizeAliasedSwatchInkDataOldAndNew (ISwatchList* iSwatchList, const UIDRef& swatchRef, UID newUID) = 0;
751 
757  virtual void ProcessMakeSwatchAliasCommand (ISwatchList* iSwatchList, UID swatchUID, UID aliasSwatchUID) = 0;
758 
769  virtual UID HandleAlternateSwatchMatch (const UIDRef& srcSwatchRef, ISwatchList* iSwatchList, const UIDRef& altSwatchRef, ISwatchUtils::ActionCode actionCode, ISwatchUtils::CompareCode resultCode) = 0;
770 
786  virtual UID HandleAlternateSwatchMatch (ISwatchList* iSwatchList, const UIDRef& altSwatchRef, const PMString& , const PMString&, int32, const ColorArray&, const IInkData::InkType&, bool16, ISwatchUtils::ActionCode) = 0;
787 
791  virtual ISwatchUtils::ActionCode CancelDuplicateSpotColorSwatchAlert() = 0; //always returns kCancelAction
792 
802  virtual ISwatchUtils::ActionCode InvokeSameSwatchAlert( const ISwatchUtils::CompareCode& compareResult, PMString swatchName, bool16 isSpot = kFalse, bool16 allowCancel = kTrue, PMString alternateName = PMString("") ) = 0;
803 
838  (
839  ISwatchList* iSwatchList,
840  const PMString& colorName,
841  int32 colorSpace,
842  const ColorArray& colorArray
843  ) = 0;
844 
845  //___________________________________________________________________________________
846  // Library swatches to K2 swatches conversion
847  //___________________________________________________________________________________
858  (
859  const UIDRef& libSwatchRef,
860  IWorkspace* iDestinationWS,
861  bool16 doCheckForConflicts,
862  bool16 doUpdateGfxState,
863  int32 nSwatchFlags = kNoFlags,
864  const UID& colorGroup = kInvalidUID
865  ) = 0;
866 
876  (
877  const UIDRef& libSwatchRef,
878  IWorkspace* iDestinationWS,
879  UIDList* pNewColorUIDList,
880  bool16 doCheckForConflicts,
881  bool16 doUpdateGfxState
882  ) = 0;
883 
884 
894  virtual UID AddBookSwatch
895  (
896  ISwatchList* iSwatchList,
897  const UIDRef& bookRef,
898  int32 swatchIndex,
899  const PMString& swatchName,
900  bool16 doLockSwatch,
901  const UID& colorGroup = kInvalidUID
902  ) = 0;
903 
904  //___________________________________________________________________________________
905  // Panetone library swatch name helper
906  //___________________________________________________________________________________
911  virtual PMString GetAlternatePanetoneSwatchName (const PMString& swatchName) = 0;
912 
919  virtual ISwatchUtils::SwatchNameMatchType FindAlternateSwatchName (ISwatchList* iSwatchList, const PMString& swatchName, UIDRef& altSwatchRef, PMString* pAlterateName = nil) = 0;
920 
925  virtual PMString GetAlternatePanetoneSwatchNameSuffix (const PMString& pantoneSuffixString) = 0;
926 
934  virtual ErrorCode ConvertSwatchProfile( ISwatchList* pSwatchList, const UIDList& listSrcColors, UIDList& listDstColors, IDataBase* pDstDB ) = 0;
935 
945  virtual ActionCode CheckProfilesBeforeCopy(ActionCode inActionCode, bool16 inDoAlertUser, const UIDRef &inSrcSwatchRef, ISwatchList *inDstSwatchList, UIDRef& refMatched, bool16 bAllowCancel = kTrue) = 0;
946 
947 
954  virtual bool16 SwatchIsUsed (IDataBase* iDataBase, UID swatchUID, ISwatchUtils::SwatchUsageType usageType) = 0;
955 
969  virtual void GetSwatchReferences (IDataBase* iDataBase, UIDList& referencedList, UIDList& unusedList, bool16 includeVisibleSwatches, bool16 includeUnnamedSwatches, ISwatchUtils::SwatchUsageType usageType) = 0;
970 
976  virtual void GetSwatchReferencesByObject (const UIDRef& objectUIDRef, UIDList& referencedList) = 0;
977 };
978 
979 
980 #endif // __ISwatchUtils__