InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ISwatchList Class Referenceabstract

#include <ISwatchList.h>

Inheritance diagram for ISwatchList:
IPMUnknown

Public Types

enum  { kDefaultIID = IID_ISWATCHLIST }
 
enum  { kNotFound = -1 }
 

Public Member Functions

virtual void Init ()=0
 
virtual UIDRef FindSwatch (const PMString &name) const =0
 
virtual UIDRef FindSwatch (const int32 &colorSpace, const ColorArray &colorArray) const =0
 
virtual UIDRef FindSwatch (IColorData *colorData) const =0
 
virtual UIDRef FindSwatch (IGradientFill *gradient) const =0
 
virtual int32 SwatchLocation (const UID &swatchUID) const =0
 
virtual int32 VisibleSwatchLocation (const UID &swatch) const =0
 
virtual int32 GetNumSwatches () const =0
 
virtual int32 GetNumVisibleSwatches () const =0
 
virtual int32 GetNumNamedSwatches () const =0
 
virtual UIDRef GetNthSwatch (int32 index) const =0
 
virtual UIDRef GetNthVisibleSwatch (int32 index) const =0
 
virtual UIDRef GetNthNamedSwatch (int32 index) const =0
 
virtual void AddSwatch (const UID &swatch)=0
 
virtual void RemoveSwatch (const UID &swatch)=0
 
virtual void RemoveSwatch (const UIDList *itemList)=0
 
virtual void Move (int32 fromIndex, int32 toIndex)=0
 
virtual void SortVisibleSwatchesByName ()=0
 
virtual UID GetBlackSwatchUID () const =0
 
virtual UID GetPaperSwatchUID () const =0
 
virtual UID GetRegistrationSwatchUID () const =0
 
virtual UID GetNoneSwatchUID () const =0
 
- Public Member Functions inherited from IPMUnknown
virtual IPMUnknownQueryInterface (PMIID interfaceID) const =0
 
virtual void AddRef () const =0
 
virtual void Release () const =0
 

Detailed Description

An interface for managing InDesign swatch list. A swatch is a rendering object boss derived from kK2RenderObjectBoss and must implement IRenderingObject interface. All rendering object must also provide IRenderObjectService implementation through kRenderingObjectService service provider. This facilitates the management of the rendering objects. In addition, all rendering objects must also provide creation, change, and deletion commands. For example, the solid color objects are kPMColorBoss. It provides kNewColorCmdBoss for creating new basic color objects, kChangeColorCmdBoss for changing properties of the colors, and kDeleteColorCmdBoss for deleting the color opbjects.

The swatches can be unnamed or named. Swatches can also be visible in the UI or not.

Currently supported rendering objects (or swatches) are kPMColorBoss, kGradientRenderingObjectBoss, and kGraphicStateNoneRenderingObjectBoss.

See Also
ColorSystemID.h
GradientFillID.h
GraphicStylesID.h
IRenderingObject
IRenderObjectService

Member Function Documentation

virtual void ISwatchList::AddSwatch (const UIDswatch)
pure virtual

Add swatch to the list. This should also update the visible list based on its visibility setting.

Parameters
swatchthe new swatch UID to add. This should be an UID of a rendering object boss.
virtual UIDRef ISwatchList::FindSwatch (const PMStringname) const
pure virtual

Find a swatch by name in the list and return the swatch UIDRef.

Parameters
namethe swatch name to find.
Returns
the matching swtach UIDRef. If not found, returns UIDRef::gNull. UIDRef is the UIDRef of the any matching color rendering object boss.
virtual UIDRef ISwatchList::FindSwatch (const int32 & colorSpace,
const ColorArraycolorArray 
) const
pure virtual

Find a swatch by color space and components in the list and return the swatch UIDRef.

Parameters
colorSpacethe color space to find.
colorArraythe color value to find.
Returns
the matching swtach UIDRef. If not found, returns UIDRef::gNull. UIDRef is the UIDRef of the matching color rendering object boss (kPMColorBoss).
virtual UIDRef ISwatchList::FindSwatch (IColorDatacolorData) const
pure virtual

Find a swatch by content of color data in the list and return the swatch UIDRef.

Parameters
colorDatathe color data to find.
Returns
the matching swtach UIDRef. If not found, returns UIDRef::gNull. UIDRef is the UIDRef of the matching color rendering object boss (kPMColorBoss).
See Also
IColorData
virtual UIDRef ISwatchList::FindSwatch (IGradientFillgradient) const
pure virtual

Find a swatch by content of gradient data in the list and return the swatch UIDRef.

Parameters
gradientthe gradient data to find.
Returns
the matching swtach UIDRef. If not found, returns UIDRef::gNull. UIDRef is the UIDRef of the matching gradient rendering object boss (kGradientRenderingObjectBoss).
See Also
IGradientFill
virtual UID ISwatchList::GetBlackSwatchUID () const
pure virtual

Return the UID of the [Black] swatch. If not in the list, kInvalidUID is returned.

Returns
UID of Black swatch.
virtual UID ISwatchList::GetNoneSwatchUID () const
pure virtual

Return the UID of the [None] swatch. If not in the list, kInvalidUID is returned.

Returns
UID of None swatch.
virtual UIDRef ISwatchList::GetNthNamedSwatch (int32 index) const
pure virtual

Returns the UIDRef of the nth named swatch in the named list. Returns kInvalidUID if there are no named swatches. The ordering swatches in this list may not be the same as the visible list or the total list.

Parameters
indexthe nth named swatch starting from index 0.
Returns
UIDRef of the nth named swatch. Returns UIDRef::gNull if index is out of range. UIDRef is the UIDRef of a rendering object boss.
virtual UIDRef ISwatchList::GetNthSwatch (int32 index) const
pure virtual

Returns the UIDRef of the nth swatch in the total list.

Parameters
indexthe nth swatch starting from index 0.
Returns
UIDRef of the nth swatch. Returns UIDRef::gNull if index is out of range. UIDRef is the UIDRef of a rendering object boss.
virtual UIDRef ISwatchList::GetNthVisibleSwatch (int32 index) const
pure virtual

Returns the UIDRef of the nth swatch in the visible list. Returns kInvalidUID if there are no visible swatches. The order ot these swatches is the order shown in the swatches panel.

Parameters
indexthe nth visible swatch starting from index 0.
Returns
UIDRef of the nth visible swatch. Returns UIDRef::gNull if index is out of range. UIDRef is the UIDRef of a rendering object boss.
virtual int32 ISwatchList::GetNumNamedSwatches () const
pure virtual

Returns the number of named swatches if any.

Returns
the number of named swatches.
virtual int32 ISwatchList::GetNumSwatches () const
pure virtual

Get total number of swatches in the list, including unnamed swatches, hidden swatches and visible swatches (swatches shown in the swatch panel).

Returns
the total number of swatches in the list.
virtual int32 ISwatchList::GetNumVisibleSwatches () const
pure virtual

Returns the number of visible swatches if any.

Returns
the number of visible swatches.
virtual UID ISwatchList::GetPaperSwatchUID () const
pure virtual

Return the UID of the [Paper] swatch. If not in the list, kInvalidUID is returned.

Returns
UID of Paper swatch.
virtual UID ISwatchList::GetRegistrationSwatchUID () const
pure virtual

Return the UID of the [Registration] swatch. If not in the list, kInvalidUID is returned.

Returns
UID of Registration swatch.
virtual void ISwatchList::Init ()
pure virtual

Initialize the swatch list.

virtual void ISwatchList::Move (int32 fromIndex,
int32 toIndex 
)
pure virtual

Move a swatch at fromIndex position to toIndex position in the visible list.

Parameters
fromIndexthe original position of the swatch.
toIndexthe new position of the swatch.
virtual void ISwatchList::RemoveSwatch (const UIDswatch)
pure virtual

Remove swatch from the list. This should also update the visible list based on its visibility setting if necessary.

Parameters
swatchthe swatch UID to remove. This should be an UID of a rendering object boss.
virtual void ISwatchList::RemoveSwatch (const UIDListitemList)
pure virtual

Remove a list of swatches from the swatch list. This should also updates the visible list based on their visibility setting if necessary.

Parameters
itemListthe list of swatches to remove. These should be UIDs of rendering object bosses.
virtual void ISwatchList::SortVisibleSwatchesByName ()
pure virtual

Sort the visible swatch list by name in the alphabetical order. If all swatches are unnamed, then this method does nothing.

virtual int32 ISwatchList::SwatchLocation (const UIDswatchUID) const
pure virtual

Find a swatch by the Swatch UID and return its index in the swatch list.

Parameters
swatchUIDthe swatch UID to find.
Returns
the index of the swatch in the list starting from index 0. If no such UID is found, returns -1.
virtual int32 ISwatchList::VisibleSwatchLocation (const UIDswatch) const
pure virtual

Find a swatch by UID and return its index in the visible list.

Parameters
swatchUIDthe swatch UID to find.
Returns
the index of the swatch in the visible list. If no such UID is found, returns -1.