You are on page 1of 1

CHAPTER 4: Graphics Graphic attributes 127

Solution

There is no backward link from the profile to the images that use that profile, so you must iterate through
the images using the link manager interfaces to find the images that use a specific profile. Follow these
steps:

1. Get the UID of the profile the current image uses, by querying the IID_ICMSPROFILEUID interface and
using IPersistUIDData->GetUID.

2. Get the ILinksManager interface from the document boss.

3. For each UIDRef of a link item gotten from ILinksManager::GetNthLinkUID, instantiate


IID_ICMSPROFILEUID and compare the UID of the ICC profile with the current image’s profile UID.
When the UIDs match, add the image to the list.

Related APIs

 ICMSProfile

 ICMSProfileList

 ICMSUtils

 ILinksManager

 IPersistUIDData

Graphic attributes
Applying multiple graphic attributes to page items
You can apply multiple graphic attributes to page items.

Solution

1. Determine the attributes you want apply. Typically, you should know the boss ClassID for each
attribute.

2. Create kGfxApplyMultAttributesCmdBoss using CmdUtils::CreateCommand, and set a UIDList of the


page items in the command’s item list.

3. Create an instance of each appropriate attribute boss object, and set the appropriate attribute value.
This can be done by using the CreateObject method (from CreateObject.h), querying for the attribute
data interface (such as IGraphicAttrRealNumber), and setting the value. You also can use existing
utility methods on IGraphicsAttributeUtils directly.

4. Obtain the IApplyMultAttributesCmdData command data interface, then call


IApplyMultAttributesCmdData::AddAnAttribute to add the attribute to the list in the command.
Repeat for all desired attributes.

5. Process the command.

You might also like