InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
SnpManipulateConditionalText Class Reference

Public Member Functions

 SnpManipulateConditionalText ()
 
virtual ~SnpManipulateConditionalText ()
 
void OutputConditionInfo (const UIDRef conditionRef, bool16 nameOnly=kFalse) const
 
void OutputSetInfo (const UIDRef setRef, bool16 nameOnly=kFalse) const
 
ErrorCode ListAllConditionInfo () const
 
ErrorCode ListAllConditionSetInfo () const
 
ErrorCode ListActiveConditionInfo (const IActiveContext *ac) const
 
ErrorCode ListActiveConditionSetInfo (const IActiveContext *ac) const
 
ErrorCode ListAllWorkspaceConditionInfo (const IWorkspace *ws) const
 
ErrorCode ListAllWorkspaceConditionSetInfo (const IWorkspace *ws) const
 
ErrorCode CreateDefaultCondition (const IActiveContext *ac) const
 
ErrorCode CreateCondition (IWorkspace *ws, const WideString &name, const UID colorUID, IConditionTag::IndicatorMethod method, IConditionTag::UnderlineIndicatorAppearance appearance, const bool16 visibleState, UID *newConditionTagUID) const
 
ErrorCode DeleteCondition (const UIDRef &conditionRef, const UIDRef &replacementRef) const
 
ErrorCode SetConditionOptions (const UIDRef &conditionRef, const WideString &newName, UID newColorUID, IConditionTag::IndicatorMethod newMethod, IConditionTag::UnderlineIndicatorAppearance newAppearance, bool16 newVisibleState) const
 
ErrorCode SetConditionName (const UIDRef &conditionRef, const PMString &newName) const
 
ErrorCode SetConditionVisibleState (const UIDRef &conditionRef, const bool16 &newVisibleState) const
 
ErrorCode SetConditionColor (const UIDRef &conditionRef, const UID &newColorUID) const
 
ErrorCode SetConditionMethod (const UIDRef &conditionRef, const IConditionTag::IndicatorMethod &method) const
 
ErrorCode SetConditionAppearance (const UIDRef &conditionRef, const IConditionTag::UnderlineIndicatorAppearance &appearance) const
 
ErrorCode ApplyConditions (const UIDRef &textModelRef, RangeData &rangeData, const K2Vector< UID > &conditionsToApply, bool16 removeExisting=kFalse) const
 
ErrorCode RemoveConditionTags (const UIDRef &textModelRef, RangeData &rangeData, const K2Vector< UID > &conditionsToRemove, bool16 removeAll=kFalse) const
 
ErrorCode ListAppliedConditionTags (const UIDRef &textModelRef, RangeData &rangeData) const
 
ErrorCode SetShowConditionIndicators (IWorkspace *ws, IConditionalTextOptions::ConditionIndicatorsMode showIndicatorsMode) const
 
ErrorCode LoadConditions (IWorkspace *ws, const IDFile &sourceFile, bool16 loadConditionSets) const
 
ErrorCode CreateConditionSet (IWorkspace *ws, const WideString &name, UID *newConditionSetUID) const
 
ErrorCode ShowAllConditionsInActiveSet (IWorkspace *ws, bool16 doShow) const
 
ErrorCode DeleteConditionSet (const UIDRef &setRef) const
 
ErrorCode SetActiveConditionSet (IWorkspace *ws, const UIDRef &setRef) const
 
ErrorCode ModifyConditionSetName (const UIDRef &setRef, const WideString &newName) const
 
ErrorCode RedefineActiveConditionSet (IWorkspace *ws) const
 
const K2Vector< PMString > & QueryConditionIndicatorMethodNames () const
 
const K2Vector< PMString > & QueryConditionIndicatorAppearanceNames () const
 
const K2Vector< PMString > & QueryShowIndicatorsModeNames () const
 

Detailed Description

The SnpManipulateConditionalText snippet demonstrates the use of the ConditionalTextFacade (IConditionalTextFacade) to manipulate Conditions (kConditionTagBoss) and Condition Sets (kConditionTagSetBoss) in a workspace, and to apply conditions to text. The following functionality is demonstrated:

  • List all conditions for the session and all open documents
  • List all condition sets for the session and all open documents
  • List the conditions in the active workspace
  • List the condition sets in the active workspace
  • Load conditions and condition sets from an InDesign file
  • Show or Hide condition indicators
  • Create a condition in the active workspace
  • Delete a condition from the active workspace
  • Set the options for a condition: name, color, visiblity, indicator method (e.g. kUnderline), and indicator appearance (e.g. kSingleWavy)
  • Apply a condition to the text model
  • Remove a condition from the text model
  • List the conditions applied to the text model
  • Create a condition set
  • Show or Hide all conditions in a condition set
  • Delete a condition set
  • Set the active condition set
  • Rename a condition set
  • Redefine a condition set
See Also
_SnpRunnerManipulateConditionalText::Run
IConditionalTextFacade.h
IConditionTag.h
IConditionTagSet.h

Constructor & Destructor Documentation

SnpManipulateConditionalText::SnpManipulateConditionalText ()

Constructor

virtual SnpManipulateConditionalText::~SnpManipulateConditionalText ()
inlinevirtual

Destructor

Member Function Documentation

ErrorCode SnpManipulateConditionalText::ApplyConditions (const UIDReftextModelRef,
RangeDatarangeData,
const K2Vector< UID > & conditionsToApply,
bool16 removeExisting = kFalse 
) const

Apply Conditions to text

Parameters
textModelRefIN specifies text model ref on which to apply the condition
rangeDataIN location in the text model to apply the condition
conditionsToApplyIN uid list of the conditions to apply (can be empty and used with removeExisting to remove all conditions)
removeExistingIN true to remove existing applied conditions
Returns
ErrorCode kSuccess on success, other ErrorCode otherwise.
ErrorCode SnpManipulateConditionalText::CreateCondition (IWorkspacews,
const WideStringname,
const UID colorUID,
IConditionTag::IndicatorMethod method,
IConditionTag::UnderlineIndicatorAppearance appearance,
const bool16 visibleState,
UIDnewConditionTagUID 
) const

Creates a new condition using the specified values

Parameters
wsIN specifies the workspace in which the condition is to be created
nameIN the name of the condition
colorUIDIN the color of the condition
methodIN the indicator method used to specify how to draw the indicator (e.g. IConditionTag::kUnderline)
appearanceIN the underline indicator appearance (e.g. IConditionTag::kSingleWavy)
visibleStateIN whether the text associated with the condition is visible
newConditionTagUIDOUT the UID of the new condition
Returns
ErrorCode kSuccess on success, other ErrorCode otherwise.
ErrorCode SnpManipulateConditionalText::CreateConditionSet (IWorkspacews,
const WideStringname,
UIDnewConditionSetUID 
) const

Create a new condition set. For this example, all conditions in the specified workspace are added to the new set at their current visibility.

Parameters
wsIN the workspace to create the set in
nameIN the name for the condition set
newConditionSetUIDOUT the UID of the new set
Returns
ErrorCode kSuccess on success, other ErrorCode otherwise.
ErrorCode SnpManipulateConditionalText::CreateDefaultCondition (const IActiveContextac) const

Creates a new condition using the IConditionalTextFacade default values

Parameters
acIN specifies active context in which the condition is to be created
Returns
ErrorCode kSuccess on success, other ErrorCode otherwise.
ErrorCode SnpManipulateConditionalText::DeleteCondition (const UIDRefconditionRef,
const UIDRefreplacementRef 
) const

Deletes a condition, and allows replacement of that condition with another condition (applies the replacement condition to the text model in the places where the deleted condition had been applied.)

Parameters
conditionRefIN the UIDRef of the condition to delete
replacementRefIN the UIDRef of the condition with which to replace the deleted condition
Returns
ErrorCode kSuccess on success, other ErrorCode otherwise.
ErrorCode SnpManipulateConditionalText::DeleteConditionSet (const UIDRefsetRef) const

Delete a condition set.

Parameters
setRefIN uid reference of the set to delete
Returns
ErrorCode kSuccess on success, other ErrorCode otherwise.
ErrorCode SnpManipulateConditionalText::ListActiveConditionInfo (const IActiveContextac) const

Outputs information about the conditions in the active context's workspace

Parameters
acIN specifies active context to list conditions for
Returns
ErrorCode kSuccess on success, other ErrorCode otherwise.
ErrorCode SnpManipulateConditionalText::ListActiveConditionSetInfo (const IActiveContextac) const

Outputs information about all the tags in the active context's workspace

Parameters
acIN specifies active context to list condition sets for
Returns
ErrorCode kSuccess on success, other ErrorCode otherwise.
ErrorCode SnpManipulateConditionalText::ListAllConditionInfo () const

Outputs information about all the Conditions in the session workspace and the open document(s) workspace

Returns
ErrorCode kSuccess on success, other ErrorCode otherwise.
ErrorCode SnpManipulateConditionalText::ListAllConditionSetInfo () const

Outputs information about all the ConditionSets in the session workspace and the open document(s) workspace

Returns
ErrorCode kSuccess on success, other ErrorCode otherwise.
ErrorCode SnpManipulateConditionalText::ListAllWorkspaceConditionInfo (const IWorkspacews) const

Outputs information about all the Conditions in the specified workspace

Parameters
wsIN specifies workspace to inspect
Returns
ErrorCode kSuccess on success, other ErrorCode otherwise.
ErrorCode SnpManipulateConditionalText::ListAllWorkspaceConditionSetInfo (const IWorkspacews) const

Outputs information about all the ConditionSets in the specified workspace

Parameters
wsIN specifies workspace to inspect
Returns
ErrorCode kSuccess on success, other ErrorCode otherwise.
ErrorCode SnpManipulateConditionalText::ListAppliedConditionTags (const UIDReftextModelRef,
RangeDatarangeData 
) const

Display info about the applied Conditions in the specified text model range

Parameters
textModelRefIN specifies text model ref on which to inspect applied conditions
rangeDataIN location in the text model to inspect applied conditions
Returns
ErrorCode kSuccess on success, other ErrorCode otherwise.
ErrorCode SnpManipulateConditionalText::LoadConditions (IWorkspacews,
const IDFilesourceFile,
bool16 loadConditionSets 
) const

Copy the conditions and condition sets from an InDesign file to the specified workspace.

Parameters
wsIN workspace to copy the conditions and sets to.
sourceFileIN the InDesign file to load the conditions from.
loadConditionSetsIN if kTrue then loads conditions and condition sets; otherwise, only loads the conditions.
Returns
ErrorCode kSuccess on success, other ErrorCode otherwise.
ErrorCode SnpManipulateConditionalText::ModifyConditionSetName (const UIDRefsetRef,
const WideStringnewName 
) const

Modify the specified condition set's name

Parameters
setRefIN uid reference to the set to modify
newNameIN the new name for the condition set
Returns
ErrorCode kSuccess on success, other ErrorCode otherwise.
void SnpManipulateConditionalText::OutputConditionInfo (const UIDRef conditionRef,
bool16 nameOnly = kFalse 
) const

Outputs information about a Condition

Parameters
conditionRefIN specifies Condition to inspect
nameOnlyIN specifies to output only the condition's name
void SnpManipulateConditionalText::OutputSetInfo (const UIDRef setRef,
bool16 nameOnly = kFalse 
) const

Outputs information about a ConditionSet

Parameters
setRefIN the ConditionSet to inspect
nameOnlyIN specifies to output only the condition set's name
ErrorCode SnpManipulateConditionalText::RedefineActiveConditionSet (IWorkspacews) const

Redefine the active condition set. For this example, the set is redefined to contain all conditions in the specified workspace at their current visibility.

Parameters
wsIN the workspace to get the active set from
Returns
ErrorCode kSuccess on success, other ErrorCode otherwise.
ErrorCode SnpManipulateConditionalText::RemoveConditionTags (const UIDReftextModelRef,
RangeDatarangeData,
const K2Vector< UID > & conditionsToRemove,
bool16 removeAll = kFalse 
) const

Remove Condition Tag from text

Parameters
textModelRefIN specifies text model ref on which to apply the condition
rangeDataIN location in the text model to apply the condition
conditionsToRemoveIN uid list of the conditions to remove (unapply) from the text
removeAllIN true to remove all applied conditions from the text
Returns
ErrorCode kSuccess on success, other ErrorCode otherwise.
ErrorCode SnpManipulateConditionalText::SetActiveConditionSet (IWorkspacews,
const UIDRefsetRef 
) const

Set the active condition set

Parameters
wsIN the workspace to create the set in
setRefIN uid reference of the set to make active
Returns
ErrorCode kSuccess on success, other ErrorCode otherwise.
ErrorCode SnpManipulateConditionalText::SetConditionAppearance (const UIDRefconditionRef,
const IConditionTag::UnderlineIndicatorAppearance & appearance 
) const

Set the appearance of a condition (has no effect if conditions's indicator method is kHighlight)

Parameters
conditionRefIN the UIDRef of the condition to modify
appearanceIN the appearance to use when drawing the condition indicator (e.g. kSingleWavy)
Returns
ErrorCode kSuccess on success, other ErrorCode otherwise.
ErrorCode SnpManipulateConditionalText::SetConditionColor (const UIDRefconditionRef,
const UIDnewColorUID 
) const

Set the color of a condition

Parameters
conditionRefIN the UIDRef of the condition to modify
newColorUIDIN the UID of the color to use when drawing the condition indicator
Returns
ErrorCode kSuccess on success, other ErrorCode otherwise.
ErrorCode SnpManipulateConditionalText::SetConditionMethod (const UIDRefconditionRef,
const IConditionTag::IndicatorMethod & method 
) const

Set the method of a condition. The method is a constant specifying how to draw the condition indicator.

Parameters
conditionRefIN the UIDRef of the condition to modify
methodIN the method to use when drawing the condition indicator (e.g. kHighlight)
Returns
ErrorCode kSuccess on success, other ErrorCode otherwise.
ErrorCode SnpManipulateConditionalText::SetConditionName (const UIDRefconditionRef,
const PMStringnewName 
) const

Rename a condition

Parameters
conditionRefIN the UIDRef of the condition to modify
newNameIN the new name for the condition
Returns
ErrorCode kSuccess on success, other ErrorCode otherwise.
ErrorCode SnpManipulateConditionalText::SetConditionOptions (const UIDRefconditionRef,
const WideStringnewName,
UID newColorUID,
IConditionTag::IndicatorMethod newMethod,
IConditionTag::UnderlineIndicatorAppearance newAppearance,
bool16 newVisibleState 
) const

Set the options for an existing condition

Parameters
conditionRefIN The UIDRef of the condition to edit.
newNameIN The new name condition.
newColorUIDIN The new color UID for the condition.
newMethodIN The new indicator method for the condition (e.g. kHighlight).
newAppearanceIN The new underline indicator appearance for the condition (e.g. kSingleWavy).
newVisibleStateIN The new visible state for the condition.
Returns
ErrorCode kSuccess on success, other ErrorCode otherwise.
ErrorCode SnpManipulateConditionalText::SetConditionVisibleState (const UIDRefconditionRef,
const bool16 & newVisibleState 
) const

Set the visibility of a condition

Parameters
conditionRefIN the UIDRef of the condition to modify
newVisibleStateIN the new visibility setting for the condition
Returns
ErrorCode kSuccess on success, other ErrorCode otherwise.
ErrorCode SnpManipulateConditionalText::SetShowConditionIndicators (IWorkspacews,
IConditionalTextOptions::ConditionIndicatorsMode showIndicatorsMode 
) const

Show or hide the conditional text indicators. Indicators are drawn on text that has a condition applied.

Parameters
wsIN specifies workspace to modify
showIndicatorsModeIN show, show and print, or hide indicators
Returns
ErrorCode kSuccess on success, other ErrorCode otherwise.
ErrorCode SnpManipulateConditionalText::ShowAllConditionsInActiveSet (IWorkspacews,
bool16 doShow 
) const

Show or Hide all the conditions present in the active condition set

Parameters
wsIN the workspace to get the active set from
doShowIN defines whether to show or hide the conditions
Returns
ErrorCode kSuccess on success, other ErrorCode otherwise.