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

#include <IFormFieldUtils.h>

Inheritance diagram for IFormFieldUtils:
IPMUnknown

Public Types

enum  { kDefaultIID = IID_IFORMFIELDUTILS }
 
enum  NumberingStartValue { kStartNumberingWithStateNumber = -2, kStartNumberingWithNextStateNumber = -1, kStartNumberingWithOne = 1, kStartNumberingWithTwo = 2 }
 
enum  UniqueNamePolicy { kDoesNotNeedToEndInANumber, kMustEndInANumber }
 
enum  { kFixUpList = kTrue, kDontFixUpList = kFalse }
 
typedef K2Pair< UID,
Form::AppearanceState > 
UIDStatePair
 
typedef K2Vector< UIDStatePairUIDStatePairs
 

Public Member Functions

virtual bool16 CanPlaceInAnnotation (const UIDList *inItems) const =0
 
virtual bool16 CanEditItems (const UIDList *inItems) const =0
 
virtual bool16 CanEditFormItems (const UIDList *inItems) const =0
 
virtual bool16 CanDeleteState (Form::AppearanceState inState) const =0
 
virtual bool16 IsNormalState (Form::AppearanceState inState) const =0
 
virtual bool16 IsOnState (Form::AppearanceState inState) const =0
 
virtual bool16 IsOffState (Form::AppearanceState inState) const =0
 
virtual bool16 IsDefinedState (Form::AppearanceState inState) const =0
 
virtual PMString GetDefinedStateName (Form::AppearanceState inState) const =0
 
virtual ErrorCode ProcessChangeStateCmd (const UIDRef &inItemRef, Form::AppearanceState inState) const =0
 
virtual UIDRef CreateFormPageItem (const UIDRef &inParent, const PMRect &inBounds, ClassID inFormFieldBoss) const =0
 
virtual ErrorCode AddFormFieldContent (UIDRef &inFormField) const =0
 
virtual IFormFieldFactoryQueryFormFieldFactory (ClassID inFactoryBoss) const =0
 
virtual ErrorCode SetAppearanceState (UIDRef &inPageItem, Form::AppearanceState inState) const =0
 
virtual Form::AppearanceState GetChildAppearanceState (IPMUnknown *inPageItem, UIDRef *outAppearanceParent, Form::AppearanceState *outActiveState) const =0
 
virtual void AddFormFieldAttributes (IGraphicStyleAttributeBossList *inSrcList, IApplyMultAttributesCmdData *inApplyAttributesCmdData, const PMString &inStyleName) const =0
 
virtual PMString GetDefaultStateName (const IAppearanceList *inAppearanceList, Form::AppearanceState inState) const =0
 
virtual PMString GetDuplicateName (const IAppearanceList *inAppearanceList, Form::AppearanceState inState) const =0
 
virtual void MakeNameUniqueInAppearanceList (const IAppearanceList *inAppearanceList, PMString &inName, NumberingStartValue inStartValue, UniqueNamePolicy inNamePolicy=kDoesNotNeedToEndInANumber) const =0
 
virtual PMString GetTargetName (const IPMUnknown *inItem, const ClassID &inStartingAncestorType) const =0
 
virtual bool16 CanPlaceInState (const UIDList &inItems, const ClassID &inTargetClass) const =0
 
virtual bool16 CanCreateFromItems (const UIDList &inItems, const ClassID &inTargetClass) const =0
 
virtual UIDList GetAllFormItemsOfTypeInDocument (const UIDRef &docRef, const ClassID &classID) const =0
 
virtual ErrorCode ResetAllMultiStateObjects (const UIDRef &docRef) const =0
 
virtual ErrorCode ResetAllButtons (const UIDRef &docRef) const =0
 
virtual UIDRef GetStateWrappingGroup (const UIDRef &inItemRef, Form::AppearanceState inState) const =0
 
virtual bool16 IsItemOnlyInActiveStates (const UIDRef &inItemRef, UID *outTopmostHidingAncestor=nil) const =0
 
virtual UIDStatePairs GetStatesForItem (const UIDRef &inItemRef) const =0
 
virtual void SetStatesSoThatItemIsActive (const UIDRef &inItemRef) const =0
 
virtual void SelectActiveState (const UIDList &inItems) const =0
 
int32 StateToIndex (Form::AppearanceState inState) const
 
Form::AppearanceState IndexToState (int32 inIndex) const
 
virtual UID GetSpreadUID (IHierarchy *inPageItemHier) const =0
 
virtual void GetPageUIDs (IHierarchy *inPageItemHier, UIDList *outPageUIDs) const =0
 
virtual bool16 IsOnPage (ISpread *inSpread, int32 inPagePos, UIDList *ioPageItems, UID inPageItemUID) const =0
 
virtual void GetDescendents (IHierarchy *inHierarchy, const PMIID &inInterfaceID, UIDList *outResultList) const =0
 
virtual void GetDescendents (const UIDList &inUIDList, const PMIID &inInterfaceID, UIDList *outResultList) const =0
 
virtual UIDList ExtractPageItemsWithIID (const UIDList &inUIDList, PMIID inIID) const =0
 
virtual bool16 GetFirstAncestorOfClass (const IPMUnknown *inItem, const ClassID &inClassToFind, UIDRef &outItemRef) const =0
 
virtual ErrorCode UngroupSingleItemGroups (UIDList &inOutItems, bool16 fixUpItemList=kDontFixUpList) const =0
 
virtual ErrorCode ChangeHierarchyPreservingTransform (UIDRef inItemToChange, UID inNewParent) const =0
 
virtual ErrorCode GetAppearanceThumbnail (UIDRef inAppearanceItemRef, Form::AppearanceState inState, int32 inMaxWidth, int32 inMaxHeight, AGMImageAccessor **pOutAGMImage) const =0
 
virtual bool16 HasButtonOrFormField (const UIDList &inItems, const ClassID &inTargetClass) const =0
 
virtual void TakeActionOnMissingFontFormAdornment (ILayoutSelectionSuite *iLayoutSelectionSuite, UIDRef item, bool16 shiftKeyDown, bool16 altOptionKeyDown)=0
 
virtual bool DoesHaveFontAttribute (const UIDRef &uidRef)=0
 
virtual ErrorCode SetFontFamilyAttrCmd (const UIDList &uidList, const PMString &fontFamilyName) const =0
 
virtual ErrorCode SetFontFamilyAttr (const UIDList &uidList, const PMString &fontFamilyName) const =0
 
virtual ErrorCode SetFontFamilyUIDAttrCmd (const UIDList &uidList, const UID &fontUID) const =0
 
virtual ErrorCode SetFontFamilyUIDAttr (const UIDList &uidList, const UID &fontUID) const =0
 
virtual ErrorCode SetFontStyleAttributeCmd (const UIDList &uidList, const PMString &fontStyleName) const =0
 
virtual ErrorCode SetFontStyleAttribute (const UIDList &uidList, const PMString &fontStyleName) const =0
 
virtual bool16 GetFontFamilyUIDAttr (const UIDRef &uidRef, UID &FontUID) const =0
 
virtual bool16 GetFontStyleAttribute (const UIDRef &uidRef, PMString &fontStyleName) 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

Some Miscellaneous FormField related utilities.

Member Enumeration Documentation

anonymous enum
Ungroups all of the single item groups passed in.

Parameters
inOutItemsthe items to look through
fixUpItemListif this is true, then when a single-item group is ungrouped, the group's UID is replaced with its child UID in inOutItems
Returns
kSuccess if all ungroup commands were successful, otherwise kFailure

Make a string unique from all the state names in an appearance list.

Parameters
inAppearanceListthe appearance list that the string should be unique in
inNamethe string to be made unique
inStartValuethe number to start numering from
inNamePolicyspecify whether the unique name must have a number appended onto it

Member Function Documentation

virtual void IFormFieldUtils::AddFormFieldAttributes (IGraphicStyleAttributeBossListinSrcList,
IApplyMultAttributesCmdDatainApplyAttributesCmdData,
const PMStringinStyleName 
) const
pure virtual

Add the attribute to the

Parameters
inSrcList
inApplyAttributesCmdData
inStyleName
virtual ErrorCode IFormFieldUtils::AddFormFieldContent (UIDRefinFormField) const
pure virtual

Puts an invisible place holder item in the new page item. If the item is created as a graphic frame, it keep the empty content X from showing up,

The problem is that I want the spline graphic frame hit behavior (always hit within the spline), but I don't want the x if the shape (CFormFieldShape) is going to be drawing something, which is the case for text items, list boxes, and combo boxes if they have no children in the hierarchy.

Parameters
inFormFieldForm field to receive the dummy content
virtual bool16 IFormFieldUtils::CanCreateFromItems (const UIDListinItems,
const ClassIDinTargetClass 
) const
pure virtual

Determine if a certain form field item can be created from all of the objects in a UIDList.

Parameters
inItemsthe list of items to check
inTargetClassthe ClassID of the form field item in question
Returns
whether a form field item of the specified state can be created from the items passed in
virtual bool16 IFormFieldUtils::CanDeleteState (Form::AppearanceState inState) const
pure virtual
Returns
kTrue if state can be deleted, i.e. it exists, and is not "Normal"
virtual bool16 IFormFieldUtils::CanEditFormItems (const UIDListinItems) const
pure virtual
Returns
kTrue if all the items in inItems could be edited (not locked), and are form field page items
virtual bool16 IFormFieldUtils::CanEditItems (const UIDListinItems) const
pure virtual
Returns
kTrue if all the items in inItems could be edited (not locked)
virtual bool16 IFormFieldUtils::CanPlaceInAnnotation (const UIDListinItems) const
pure virtual
Returns
kTrue if all the items in inItems could be put inside a Form Field page item
virtual bool16 IFormFieldUtils::CanPlaceInState (const UIDListinItems,
const ClassIDinTargetClass 
) const
pure virtual

Determine if all of the objects in a UIDList can be added to a state of the specified form field class.

Parameters
inItemsthe list of items to check
inTargetClassthe ClassID of the object that the items will be added to
Returns
whether the items can be added to an item of the specified state
virtual ErrorCode IFormFieldUtils::ChangeHierarchyPreservingTransform (UIDRef inItemToChange,
UID inNewParent 
) const
pure virtual
Changes the parent of an item, while preserving its transform.

Parameters
inItemToChangethe item to move
inNewParentthe new parent of the item
Returns
kSuccess if successful, otherwise an error code indicating the problem
virtual UIDRef IFormFieldUtils::CreateFormPageItem (const UIDRefinParent,
const PMRectinBounds,
ClassID inFormFieldBoss 
) const
pure virtual

Create a new Form Field of a specified type

Parameters
inParentParent item of new form field
inBoundsBounds of new form field
inFormFieldBossType of form field to create (e.g. kPushButtonItemBoss)
Returns
Form Field UIDRef created.
virtual bool IFormFieldUtils::DoesHaveFontAttribute (const UIDRefuidRef)
pure virtual

Tells whether form field have font attribute. For example TextFields.

Parameters
uidRef- uidRef for form field item
virtual UIDList IFormFieldUtils::ExtractPageItemsWithIID (const UIDListinUIDList,
PMIID inIID 
) const
pure virtual

Filter out UIDs with a certain interface, and return them

Parameters
inUIDLista list of UIDs
inIIDThe interface id to search for
Returns
a UIDList of all the iterm from inUIDList that have a inIID interface
virtual UIDList IFormFieldUtils::GetAllFormItemsOfTypeInDocument (const UIDRefdocRef,
const ClassIDclassID 
) const
pure virtual

Gets a list of all form items of a specific type in a document.

Parameters
docRefthe document
Returns
a list of all the form items requested in the document
virtual ErrorCode IFormFieldUtils::GetAppearanceThumbnail (UIDRef inAppearanceItemRef,
Form::AppearanceState inState,
int32 inMaxWidth,
int32 inMaxHeight,
AGMImageAccessor ** pOutAGMImage 
) const
pure virtual

Get rendered appearance of an appearance state

Parameters
inAppearanceItemRefthe item to get
inStateState to get
inMaxWidthMaximum width of returned bitmap
inMaxHeightMaximum height of returned bitmap
pOutAGMImage[OUT]: On exit, points to address of a newly allocated AGMImageAccessor, which must be deleted by the client. The AGMImageAccessor contains the rendered appearance.
virtual Form::AppearanceState IFormFieldUtils::GetChildAppearanceState (IPMUnknowninPageItem,
UIDRefoutAppearanceParent,
Form::AppearanceState * outActiveState 
) const
pure virtual

Get the state that a page item appears in

Parameters
inPageItempage item for which we want to know the state The ancestor page item that contains an IAppearanceList On exit, the active state for outAppearanceParent
Returns
The state that inPageItem appears in, under *outAppearanceParent
virtual PMString IFormFieldUtils::GetDefaultStateName (const IAppearanceListinAppearanceList,
Form::AppearanceState inState 
) const
pure virtual

Get this state's the default state name. On a Multi-State Object this will be "State " followed by a number making the name unique.

Parameters
inAppearanceListthe appearance list that the name must be unique in
inStatethe state to obtain the name of
Returns
the unique name
virtual PMString IFormFieldUtils::GetDefinedStateName (Form::AppearanceState inState) const
pure virtual
Returns
The name of the state, if the state is defined; otherwise an empty string.
virtual void IFormFieldUtils::GetDescendents (IHierarchyinHierarchy,
const PMIIDinInterfaceID,
UIDListoutResultList 
) const
pure virtual

Get all page items under a certain page item that contain a certain interface, also checks inlines of text frames

Parameters
inHierarchyThe page item to search under
inInterfaceIDThe interface to search for
outResultListA list of children items that have inInterfaceID
virtual void IFormFieldUtils::GetDescendents (const UIDListinUIDList,
const PMIIDinInterfaceID,
UIDListoutResultList 
) const
pure virtual

Get all page items under certain page items that contain a certain interface, also checks inlines of text frames

Parameters
inUIDListThe page items to search under
inInterfaceIDThe interface to search for
outResultListA list of children items that have inInterfaceID
virtual PMString IFormFieldUtils::GetDuplicateName (const IAppearanceListinAppearanceList,
Form::AppearanceState inState 
) const
pure virtual

Create a state name that is unique to an appearance list, based on another name.

Parameters
inAppearanceListthe appearance list to be unique within
inOutNamethe name to start with, and after the call, the unique string that results
inAppendCopywhether or not to append the work 'Copy' to the state name while making it unique
virtual bool16 IFormFieldUtils::GetFirstAncestorOfClass (const IPMUnknowninItem,
const ClassIDinClassToFind,
UIDRefoutItemRef 
) const
pure virtual

Gets the first ancestor of a given class

Parameters
inItemthe item whose ancestor is to be looked for
inClassToFindthe class of the ancestor to be looked for
outItemRefthe ancestor
Returns
returns kTrue if a matching ancestor was found, otherwise returns kFalse
virtual bool16 IFormFieldUtils::GetFontFamilyUIDAttr (const UIDRefuidRef,
UIDFontUID 
) const
pure virtual

Gets font's UID for a form field item.

Parameters
uidRef- UID for of form field.
fontUIF- [OUT] Font UID attibute of form field.
virtual bool16 IFormFieldUtils::GetFontStyleAttribute (const UIDRefuidRef,
PMStringfontStyleName 
) const
pure virtual

Gets font style for a form field item.

Parameters
uidRef- UID for of form field.
fontUIF- [OUT] Font style attibute of form field.
virtual void IFormFieldUtils::GetPageUIDs (IHierarchyinPageItemHier,
UIDListoutPageUIDs 
) const
pure virtual

Get the pages of a page item

Parameters
inPageItemHierpage item to check, may be an inlined item
outPageUIDsOn exit, the pages which inPageItemHier appears on.
virtual UID IFormFieldUtils::GetSpreadUID (IHierarchyinPageItemHier) const
pure virtual

Get the spread of a page item

Parameters
inPageItemHierpage item to check, may be an inlined item
Returns
UID of spread.
virtual UIDStatePairs IFormFieldUtils::GetStatesForItem (const UIDRefinItemRef) const
pure virtual

Gets a list of appearance items and the states that must be set to active in order for to appear in the hierarchy. (Sorted from nearest ancestor to furthest)

Parameters
inItemRefthe item to investigate
Returns
the appearance items and the states that inItemRef resides in for those appearance items
virtual UIDRef IFormFieldUtils::GetStateWrappingGroup (const UIDRefinItemRef,
Form::AppearanceState inState 
) const
pure virtual

Get the UIDRef of the group that wraps the specified state on an Appearance Item.

Parameters
inItemRefthe appearance item
inStatethe state
Returns
the UIDRef of the group wrapping the state, if one exists; otherwise an invalid UIDRef
virtual PMString IFormFieldUtils::GetTargetName (const IPMUnknowninItem,
const ClassIDinStartingAncestorType 
) const
pure virtual

Reset the name of a state in a given appearance list

Parameters
inItemthe item whose name is to be determined
inStartingAncestorTypethe class of the ancestor to start naming the target from. Ex. if this is kMultiStateObjectItemBoss, then the target name will start with the nearest MSO's name, appending the name of each item between the MSO and inItem
Returns
the name of the target
virtual bool16 IFormFieldUtils::HasButtonOrFormField (const UIDListinItems,
const ClassIDinTargetClass 
) const
pure virtual

Determine if there's another form field/button in the UIDList provided.

Parameters
inItemsthe list of items to check
inTargetClassthe ClassID of the form field item in question
Returns
whether a form field item of the specified state can be created from the items passed in
virtual bool16 IFormFieldUtils::IsDefinedState (Form::AppearanceState inState) const
pure virtual
Returns
kTrue if state is a defined state
virtual bool16 IFormFieldUtils::IsItemOnlyInActiveStates (const UIDRefinItemRef,
UIDoutTopmostHidingAncestor = nil 
) const
pure virtual

Determine if an item is not in any hidden states. If this returns kTrue, that implies that the item is able to be found while traversing the hierarchy from in a top-down fashion.

Parameters
inItemRefthe item in question
outTopmostHidingAncestoroptional, if return value is kFalse, the UID of the topmost item in the hierarchy that is hiding inItemRef; otherwise kInvalidUID.
virtual bool16 IFormFieldUtils::IsNormalState (Form::AppearanceState inState) const
pure virtual
Returns
kTrue if state is a normal state e.g. "Normal", "Normal On", Normal Off", etc.
virtual bool16 IFormFieldUtils::IsOffState (Form::AppearanceState inState) const
pure virtual
Returns
kTrue if state is an off state e.g. "Normal Off", "Over off", etc.
virtual bool16 IFormFieldUtils::IsOnPage (ISpreadinSpread,
int32 inPagePos,
UIDListioPageItems,
UID inPageItemUID 
) const
pure virtual

Determine if a page item, inPageItemUID, is on a page in a spread, also checks to see if inPageItemUID is an inlined item on the page.

Parameters
inSpreadSpread to check
inPagePoswhich page to check on inSpread
ioPageItems(must be non-null) is empty or the result of GetItemsOnPage. If this is called repeatedly for the same spread, this saves extra calls to GetItemsOnPage
inPageItemUIDPage item that is being checked
virtual bool16 IFormFieldUtils::IsOnState (Form::AppearanceState inState) const
pure virtual
Returns
kTrue if state is an on state e.g. "Normal On", "Over On", etc.
virtual ErrorCode IFormFieldUtils::ProcessChangeStateCmd (const UIDRefinItemRef,
Form::AppearanceState inState 
) const
pure virtual

Execute a command to change the active state of a Form Field

Parameters
inItemRefPage item supporting appearance states
inStatenew active state
Returns
Error from command
virtual IFormFieldFactory* IFormFieldUtils::QueryFormFieldFactory (ClassID inFactoryBoss) const
pure virtual

Get the form field factory for a particular form field type (class id)

virtual ErrorCode IFormFieldUtils::ResetAllButtons (const UIDRefdocRef) const
pure virtual

Resets all buttons to their Normal state.

Parameters
docRefthe document to reset
Returns
ErrorCode
virtual ErrorCode IFormFieldUtils::ResetAllMultiStateObjects (const UIDRefdocRef) const
pure virtual

Resets all multi-state objects to their first state.

Parameters
docRefthe document to reset
Returns
ErrorCode
virtual void IFormFieldUtils::SelectActiveState (const UIDListinItems) const
pure virtual

Selects the group that wraps the active state of each item in inItems.

Parameters
inItemsthe items whose active states to select
virtual ErrorCode IFormFieldUtils::SetAppearanceState (UIDRefinPageItem,
Form::AppearanceState inState 
) const
pure virtual

Change the state of a form field page item using a command

virtual ErrorCode IFormFieldUtils::SetFontFamilyAttr (const UIDListuidList,
const PMStringfontFamilyName 
) const
pure virtual

Similar to SetFontFamilyAttrCmd, but it does not create command sequence for operations.

Parameters
uidList- list of UID's on which font family attribute have to be applied
virtual ErrorCode IFormFieldUtils::SetFontFamilyAttrCmd (const UIDListuidList,
const PMStringfontFamilyName 
) const
pure virtual

Set font family Attr on form fields(used during PDF export). It creates a command and runs all operation whithin the sequence.

Parameters
uidList- list of UID's on which font family attribute have to be applied
fontFamilyName- font family to be applied
virtual ErrorCode IFormFieldUtils::SetFontFamilyUIDAttr (const UIDListuidList,
const UIDfontUID 
) const
pure virtual

Similar to SetFontFamilyUIDAttrCmd, but it does not create command sequence for operations.

Parameters
uidList- list of UID's on which font family attribute have to be applied
fontUID- font's UID to be applied
virtual ErrorCode IFormFieldUtils::SetFontFamilyUIDAttrCmd (const UIDListuidList,
const UIDfontUID 
) const
pure virtual

Set Font UID on form fields. It creates a command and runs all operation within the sequence.

Parameters
uidList- list of UID's on which font family attribute have to be applied
fontUID- font's UID to be applied
virtual ErrorCode IFormFieldUtils::SetFontStyleAttribute (const UIDListuidList,
const PMStringfontStyleName 
) const
pure virtual

Similar to SetFontStyleAttributeCmd, but it does not create command sequence for operations.

Parameters
uidList- list of UID's on which font family attribute have to be applied
fontUID- font style to be applied
virtual ErrorCode IFormFieldUtils::SetFontStyleAttributeCmd (const UIDListuidList,
const PMStringfontStyleName 
) const
pure virtual

Sets font style attribute on form fields. It creates a command and runs all operation within the sequence.

Parameters
uidList- list of UID's on which font family attribute have to be applied
fontUID- font style to be applied
virtual void IFormFieldUtils::SetStatesSoThatItemIsActive (const UIDRefinItemRef) const
pure virtual

Sets the active states of all appearance item ancestors such that inItemRef is visible in in the hierarchy.

Parameters
inItemRefthe item to cause to appear in the hierarchy
virtual void IFormFieldUtils::TakeActionOnMissingFontFormAdornment (ILayoutSelectionSuiteiLayoutSelectionSuite,
UIDRef item,
bool16 shiftKeyDown,
bool16 altOptionKeyDown 
)
pure virtual

Take action when form's missing font adronment is clicked

Parameters
iLayoutSelectionSuite- Layout selection suite
item- UIDRef of form field item whose adornment is clicked
shiftKeyDown- true if shift key is pressed
altOptionKeyDown- true if alt/option key is presssed