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

#include <ICellStylesFacade.h>

Inheritance diagram for Facade::ICellStylesFacade:
IPMUnknown

Public Types

enum  { kDefaultIID = IID_ICELLSTYLESFACADE }
 

Public Member Functions

virtual ErrorCode CopyStylesToGroup (const UIDRef &whichGroup, const UIDList &whichStyles) const =0
 
virtual const IPMUnknownQueryCellStyleHier (IDataBase *db, const UID &startingStyle, const ClassID &whichAttr, const PMIID &iid) const =0
 
virtual ErrorCode GetCellStyleAttrsResolved (const UIDRef &cellStyle, AttributeBossList &resolvedAttrs, const PMIID &attributeType) const =0
 
virtual UID GetCellStyleParagraphStyle (const UIDRef &styleRef) const =0
 
virtual ErrorCode GetOverridingParagraphStyles (const ITableModel *tableModel, const GridAddress &cellAnchor, UIDList &out_OverridingParaStyles, const UIDRef &styleToCheck=UIDRef::gNull) const =0
 
virtual ErrorCode GetCellOverrides (const ITableModel *tableModel, const GridAddress &whichCell, AttributeBossList &out_Overrides, const UIDRef &styleToCheck=UIDRef::gNull) const =0
 
virtual ErrorCode GetAllCellOverrides (const ITableModel *tableModel, const GridAddress &whichCell, AttributeBossList &out_Overrides) const =0
 
virtual ErrorCode CreateNewStyleGroup (IWorkspace *workspace, const PMString &groupName, const UID &parentUID, const int32 position, UID *out_NewGroup=nil) const =0
 
virtual UID GetRootCellStyle (IDataBase *db) const =0
 
virtual ICommandCreateEditCellStyleCmd (const UIDRef &cellStyleRef) const =0
 
virtual ErrorCode RenameCellStyle (const UIDRef &whichStyle, const PMString &newName) const =0
 
virtual ErrorCode DuplicateCellStyle (const UIDRef &whichStyle, UIDRef &out_NewStyle) const =0
 
virtual ErrorCode DuplicateCellStyles (const UIDList &stylesToDuplicate) const =0
 
virtual ErrorCode SetDefaultStyle (const UIDRef &defaultStyle) const =0
 
virtual ErrorCode ApplyCellStyle (const UIDRef &whichStyle, const UIDRef &tableModelRef, const GridArea &whichArea, const bool16 removeOverrides=kFalse, const bool16 applyParaStyle=kTrue) const =0
 
virtual ErrorCode ApplyCellStyleAndClearAll (const UIDRef &whichStyle, const UIDRef &tableModelRef, const GridArea &whichArea) const =0
 
virtual ErrorCode EditCellStyle (const PMString &styleName, const AttributeBossList *styleAttrList, IWorkspace *workspace, const UID &styleUID, const UID &basedOnStyleUID, const VirtualKey shortcutKey=kVirtualNullKey, const int16 modifiers=0, const GlobalTime *shortcutTime=nil) const =0
 
virtual ErrorCode DeleteCellStyle (const UIDRef &styleToDelete, const UID &replacementStyle=kInvalidUID, const bool16 preserveFormatting=kFalse) const =0
 
virtual ErrorCode CreateCellStyle (IWorkspace *workspace, const IStyleGroupHierarchy *parentHier, const int32 position, const PMString &syleName, UIDRef &outStyleRef, const UID &basedOnStyle=kInvalidUID, const AttributeBossList *styleAttrs=nil, const VirtualKey shortcutKey=kVirtualNullKey, const int16 modifiers=0, const GlobalTime *shortcutTime=nil) const =0
 
virtual ErrorCode CreateCellStyle (const UIDRef &tableModelRef, const GridAddress &selectedAddress, const IStyleGroupHierarchy *parentHier=nil, const int32 stylePosition=-1) const =0
 
virtual bool16 CanBreakLinkWithCellStyle (const ITableModel *tableModel, const GridArea &whichArea) const =0
 
virtual ErrorCode BreakLinkWithStyle (const UIDRef &tableModelRef, const GridArea &whichArea) const =0
 
virtual bool16 CanRedefineCellStyle (const ITableModel *tableModel, const GridAddress &whichAddress) const =0
 
virtual ErrorCode RedefineStyle (const UIDRef &tableModelRef, const GridAddress &whichAddress) const =0
 
virtual ErrorCode ClearCellStyleOverrides (const UIDRef &tableModelRef, const GridArea &whichArea) const =0
 
virtual ErrorCode ClearAllCellOverrides (const UIDRef &tableModelRef, const GridArea &whichArea) const =0
 
virtual ErrorCode GetSelectedCellStyles (const UIDRef &tableModelRef, const GridArea &whichArea, UIDList &out_SelectedStyles) const =0
 
virtual bool16 ClearParaStyleOverride (const ITableModel *tableModel, const GridAddress &whichCell) 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

Utility functions for working with cell styles. To use these functions use the Utils boss:
Utils<Facade::ICellStylesFacade>()->CreateCellStyle(...);

Member Function Documentation

virtual ErrorCode Facade::ICellStylesFacade::ApplyCellStyle (const UIDRefwhichStyle,
const UIDReftableModelRef,
const GridAreawhichArea,
const bool16 removeOverrides = kFalse,
const bool16 applyParaStyle = kTrue 
) const
pure virtual

Applies a cell style to the given area of the table.

Parameters
whichStyle[IN] the cell style to apply
tableModelRef[IN] the UIDRef of the kTableModelBoss to apply the style to
whichArea[IN] the GridArea to apply the style to
removeOverrides[IN] optional, kTrue if cell overrides should be removed, kFalse otherwise
applyParaStyle[IN] optional, kTrue if the cell style should apply its paragraph style, kFalse otherwise. The removeOverrides option is not affected by this flag. does not affect remove overrides.
Returns
kSuccess if the cell style was applied, kFailure otherwise
virtual ErrorCode Facade::ICellStylesFacade::ApplyCellStyleAndClearAll (const UIDRefwhichStyle,
const UIDReftableModelRef,
const GridAreawhichArea 
) const
pure virtual

Applies a cell style to the given area of the table and removes any local overrides.

Parameters
whichStyle[IN] the cell style to apply
tableModelRef[IN] the UIDRef of the kTableModelBoss to apply the style to
whichArea[IN] the GridArea to apply the style to
Returns
kSuccess if the cell style was applied, kFailure otherwise
virtual ErrorCode Facade::ICellStylesFacade::BreakLinkWithStyle (const UIDReftableModelRef,
const GridAreawhichArea 
) const
pure virtual

Breaks the link with the cell style for the given area. When the break link command is executed, the style for the cells in whichArea will be set to the root cell style, while all style attributes will be applied as local overrides. Any preexisting local overrides will take precedence over the style attributes being applied as local overrides.

Precondition
CanBreakLinkWithCellStyle returns kTrue
Parameters
tableModelRef[IN] the table to examine
whichArea[IN] the grid area to break the link
Returns
kSuccess if the link with the cell style was broken, kFailure otherwise
virtual bool16 Facade::ICellStylesFacade::CanBreakLinkWithCellStyle (const ITableModeltableModel,
const GridAreawhichArea 
) const
pure virtual

Tests if the break link with cell style command can be executed on the given area of the table. For this to return true, the selected area must have styles other than the root cell style (or kInvalidUID) applied to them.

Parameters
tableModel[IN] the table to examine
whichArea[IN] the area to examine
Returns
kTrue if the break link command can be executed, kFalse otherwise
virtual bool16 Facade::ICellStylesFacade::CanRedefineCellStyle (const ITableModeltableModel,
const GridAddresswhichAddress 
) const
pure virtual

Determines if the redefine cell style command can be executed. For this function to return true, the cell at the given address must have a style other than the root cell style applied to it (or kInvalidUID) and there must be cell overrides, or there is a cell style that does not define a paragraph style, or the cell style's paragraph style is overridden.

Parameters
tableModel[IN] the table model
whichAddress[IN] the address of the cell
Returns
kTrue if the break link command can be executed, kFalse otherwise
virtual ErrorCode Facade::ICellStylesFacade::ClearAllCellOverrides (const UIDReftableModelRef,
const GridAreawhichArea 
) const
pure virtual

Clears out all cell attributes from the given cell area.

Parameters
tableModelRef[IN] the table model
whichArea[IN] the GridArea to clear local overrides from
Returns
kSuccess if the local overrides were cleared, kFailure otherwise
virtual ErrorCode Facade::ICellStylesFacade::ClearCellStyleOverrides (const UIDReftableModelRef,
const GridAreawhichArea 
) const
pure virtual

Clears all cell overrides from the given areathat conflict with the applied cell style. If the root cell style is the applied style, then all overrides will be cleared. This will also clear out any overriding paragraph styles, returning the text within the cell to the style's paragraph style. If there is no cell style applied, or the applied cell style does not define the cell style, then the paragraphs are left alone.

Parameters
tableModelRef[IN] the table model
whichArea[IN] the GridArea to clear conflicting overrides from
Returns
kSuccess if the conflicting cell overrides were cleared, kFailure otherwise
virtual bool16 Facade::ICellStylesFacade::ClearParaStyleOverride (const ITableModeltableModel,
const GridAddresswhichCell 
) const
pure virtual

Clears out the paragraph style cell attribute from the given cell address.

Parameters
tableModel[IN] the table model
whichCell[IN] the GridAddress to clear local overrides from
Returns
kTrue if there were any local overrides to be were cleared and clearance work done kFalse otherwise
virtual ErrorCode Facade::ICellStylesFacade::CopyStylesToGroup (const UIDRefwhichGroup,
const UIDListwhichStyles 
) const
pure virtual

Copies the cell styles and groups given in whichStyles into the group given by whichGroup.

Parameters
whichGroup[IN] the group to copy the styles/groups into
whichStyles[IN] a list of cell styles and/or cell style groups to copy into the other cell style group
Returns
kSuccess if the groups were successfully copied, kFailure otherwise
virtual ErrorCode Facade::ICellStylesFacade::CreateCellStyle (IWorkspaceworkspace,
const IStyleGroupHierarchyparentHier,
const int32 position,
const PMStringsyleName,
UIDRefoutStyleRef,
const UIDbasedOnStyle = kInvalidUID,
const AttributeBossListstyleAttrs = nil,
const VirtualKey shortcutKey = kVirtualNullKey,
const int16 modifiers = 0,
const GlobalTimeshortcutTime = nil 
) const
pure virtual

Creates a cell style on the given workspace. The style will be named the given name (with a number after the name if a style already exists with the desired name) and if styleAttrs is not nil, with those attributes. If styleAttrs is nil, the style will not have any attributes, so its probably best to get the AttributeBossList of an existing cell style, or any table cell to duplicate.

Parameters
workspace[IN] the workspace to create the cell style on.
syleName[IN] the name for the cell style with a number
parentHier[IN] the hierarchy to place the style under
position[IN] the position within the parent hierarchy
outStyleRef[OUT] the UIDRef of the new style
basedOnStyle[IN] optional the style this style is based on, if this parameter is not provided, the new style will be based on the root style
styleAttrs[IN] optional, an AttributeBossList for the cell style, if this is nil the style will have no attributes
shortcutKey[IN] optional, the shortcut key for the style
modifiers[IN] optioanl, modifiers for the shortcut key
shortcutTime[IN] optional, the shortcut timestamp
Returns
kSuccess if the style was created, kFailure otherwise
virtual ErrorCode Facade::ICellStylesFacade::CreateCellStyle (const UIDReftableModelRef,
const GridAddressselectedAddress,
const IStyleGroupHierarchyparentHier = nil,
const int32 stylePosition = -1 
) const
pure virtual

Creates a cell style that will be based on the cell style at the give address, and whose attributes will be the overrides of the cell at that address.

Parameters
tableModelRef[IN] the table model to examine
selectedAddress[IN]the address of the cell to examine for overrides and the parent style
parentHier[IN] the style hierarchy to place the new style under, if this is not defined the root hierarchy is used
stylePosition[IN] the position under the parent hierarchy
Returns
kSuccess if the style was created, kFailure otherwise
virtual ICommand* Facade::ICellStylesFacade::CreateEditCellStyleCmd (const UIDRefcellStyleRef) const
pure virtual

Creates and returns an instance of kEditCellStyleCmdBoss. The command's interfaces will be set to edit the cell style given by cellStyleRef. The ICommand returned by this function should be wrapped in an InterfacePtr:
InterfacePtr<ICommand> editCmd(Utils<ICellStylesFacade>()->CreateEditCellStyleCmd(cellStyleRef));

Parameters
cellStyleRef[IN] the UIDRef of a cell style
Returns
the command used to edit a cell style
virtual ErrorCode Facade::ICellStylesFacade::CreateNewStyleGroup (IWorkspaceworkspace,
const PMStringgroupName,
const UIDparentUID,
const int32 position,
UIDout_NewGroup = nil 
) const
pure virtual

Creates a new cell style group.

Parameters
workspace[IN] the workspace to create the style group on
groupName[IN] the name of the style group, this should be a valid group name and be unique within the style group's parent
parentUID[IN] the parent style group
position[IN] the position within the parent group
out_NewGroup[OUT] optional, use a valid pointer to get the UID of the new style group
Returns
kSuccess if the new style group was created, kFailure otherwise
virtual ErrorCode Facade::ICellStylesFacade::DeleteCellStyle (const UIDRefstyleToDelete,
const UIDreplacementStyle = kInvalidUID,
const bool16 preserveFormatting = kFalse 
) const
pure virtual

Deletes the given cell style. If the parameter replacementStyle is provided, it will be used to replace all instances of the deleted style. The preserveFormatting parameter is only relevent if the replacement style is the root style (or not provided).

Parameters
styleToDelete[IN] the UIDRef of the style to delete
replacementStyle[IN] optional, the style to use as a replacement, defaults to the root cell style
preserveFormatting[IN] optional, if replacementStyle is the root cell style, or kInvalidUID then if this parameter is kTrue, all cell style formatting will be applied as local overrides on any cell using the style that will be deleted.
Returns
kSuccess if the cell style was deleted, kFailure otherwise
virtual ErrorCode Facade::ICellStylesFacade::DuplicateCellStyle (const UIDRefwhichStyle,
UIDRefout_NewStyle 
) const
pure virtual

Duplicates a single cell style.

Parameters
whichStyle[IN] the cell style to duplicate
out_NewStyle[OUT] the UIDRef of the duplicate style
Returns
kSuccess if the style was duplicated, kFailure otherwise
virtual ErrorCode Facade::ICellStylesFacade::DuplicateCellStyles (const UIDListstylesToDuplicate) const
pure virtual

Duplicates multiple cell styles. The duplicated styles will have the same attributes, but names that end with "copy", or "copy 1", "copy 2", etc.

Parameters
stylesToDuplicate[IN] a list of cell styles to duplicate
Returns
kSuccess if the styles were duplicated, kFailure otherwise
virtual ErrorCode Facade::ICellStylesFacade::EditCellStyle (const PMStringstyleName,
const AttributeBossListstyleAttrList,
IWorkspaceworkspace,
const UIDstyleUID,
const UIDbasedOnStyleUID,
const VirtualKey shortcutKey = kVirtualNullKey,
const int16 modifiers = 0,
const GlobalTimeshortcutTime = nil 
) const
pure virtual

Edits a cell style with the given parameters.

Parameters
styleName[IN] the style name
styleAttrList[IN] the cell attributes to use for the style
workspace[IN] the workspace the cell style lives on
styleUID[IN] the UID of the cell style
basedOnStyleUID[IN] the cell style that the style should be based on
shortcutKey[IN] optional, the shortcut key
modifiers[IN] optional, the shortcut modifiers
shortcutTime[IN] optional, the shortcut timestamp
Returns
kSuccess if the cell style was applied, kFailure otherwise
virtual ErrorCode Facade::ICellStylesFacade::GetAllCellOverrides (const ITableModeltableModel,
const GridAddresswhichCell,
AttributeBossListout_Overrides 
) const
pure virtual

Gets all the cell overrides applied to the given cell, regardless of the applied style.

Parameters
tableModel[IN] the table to examine
whichCell[IN] the grid address of the cell to get the overrides from
out_Overrides[OUT] container where any local overrides will be placed
Returns
kSuccess if all local overrides were placed into out_Overrides, kFailure otherwise
virtual ErrorCode Facade::ICellStylesFacade::GetCellOverrides (const ITableModeltableModel,
const GridAddresswhichCell,
AttributeBossListout_Overrides,
const UIDRefstyleToCheck = UIDRef::gNull 
) const
pure virtual

Gets all the cell overrides applied to the given cell that conflict with either the applied cell style or the style passed into the function. If the passed in style is its default and the applied cell style is the root cell style, then all overrides will be returned by this function.

Parameters
tableModel[IN] the table to examine
whichCell[IN] the grid address of the cell to get the overrides from
out_Overrides[OUT] container where any local overrides will be placed
styleToCheck[IN] optional the style that will be checked against when searching for a paragraph style override. If left to its default, this function will check against the style currently applied to the cell.
Returns
kSuccess if all local overrides were placed into out_Overrides, kFailure otherwise
virtual ErrorCode Facade::ICellStylesFacade::GetCellStyleAttrsResolved (const UIDRefcellStyle,
AttributeBossListresolvedAttrs,
const PMIIDattributeType 
) const
pure virtual

Resolves the style hierarchy for the given cell style. All cell styles are descendants of the root cell style, so starting at the root, each style in the branch leading to cellStyle will be queried for their attributes, with any conflicts between nodes resolved by using the value of the style farther down the branch .

Parameters
cellStyle[IN] the table style
out_ResolvedAttrs[OUT] the resolved cell style attributes
attributeType[IN] the type of cell style attributes you want, for the horizontal table version use IID_ITABLEATTRIBUTES, for the vertical table version use IID_IVERTICALCELLSTYLEATTRIBUTES
Returns
kSuccess if the attributes were resolved, kFailure otherwise
virtual UID Facade::ICellStylesFacade::GetCellStyleParagraphStyle (const UIDRefstyleRef) const
pure virtual

Gets the paragraph style associated with the given cell style. This function will go up the cell style hierarchy to find the paragraph style.

Parameters
styleRef[IN] the cell style to get the pargraph style from
Returns
the UID of the paragraph style associated with the cell style, or kInvalidUID if there is no associated paragraph style
virtual ErrorCode Facade::ICellStylesFacade::GetOverridingParagraphStyles (const ITableModeltableModel,
const GridAddresscellAnchor,
UIDListout_OverridingParaStyles,
const UIDRefstyleToCheck = UIDRef::gNull 
) const
pure virtual

Goes through the given cell, checking all the paragraph styles used in that cell. If the used paragraph styles do not match the paragraph style defined by the cell style then those paragraph styles are returned in out_OverridingParaStyles. If the applied cell style does not define a paragraph style, then no applied paragraph style is considered an override.

Parameters
tableModel[IN] the table to examine
cellAnchor[IN] the grid address of the cell to examine
out_OverridingParaStyles[OUT] the list of overriding paragraph styles
styleToCheck[IN] optional the style that will be checked against when searching for overrides. If left to its default, this function will check against the style currently applied to the cell.
Returns
kSuccess if the cell was examined and all overriding paragraph style were returned, kFailure otherwise
virtual UID Facade::ICellStylesFacade::GetRootCellStyle (IDataBasedb) const
pure virtual

Returns the root cell style for the given database.

Parameters
db[IN] the IDataBase to get the root style from
Returns
the root cell style
virtual ErrorCode Facade::ICellStylesFacade::GetSelectedCellStyles (const UIDReftableModelRef,
const GridAreawhichArea,
UIDListout_SelectedStyles 
) const
pure virtual

Gets all the cell styles used in the selected area. The parameter out_SelectedStyles will be filled with the styles that are being used in whichArea, each style will only appear once.

Parameters
tableModelRef[IN] the table
whichArea[IN] the GridArea to examine
out_SelectedStyles[IN] a list containing all the styles used in the selected area
Returns
kSuccess if the used styles were returned, kFailure otherwise
virtual const IPMUnknown* Facade::ICellStylesFacade::QueryCellStyleHier (IDataBasedb,
const UIDstartingStyle,
const ClassIDwhichAttr,
const PMIIDiid 
) const
pure virtual

Goes through the cell style hierarchy and looks for the desired attribute. The interface returned by this function must be released by the caller.

Parameters
db[IN] the database
startingStyle[IN] the style to start with
whichAttr[IN] which cell attribute
iid[IN] the PMIID of the attribute, should be something like IID_ITABLEATTRUID, use IID_UNKNOWN if you don't know
Returns
the value of the attribute, if it exists
virtual ErrorCode Facade::ICellStylesFacade::RedefineStyle (const UIDReftableModelRef,
const GridAddresswhichAddress 
) const
pure virtual

Redefines the cell style at the given address to use the style attributes along with any local overrides as the style's new attributes. Local overrides will take precedence whenever any conflicts exist. The paragraph style of the first paragraph in the cell will be used as the cell style's paragraph style.

Parameters
tableModelRef[IN] the table to examine
whichAddress[IN] the GridAddress of a cell anchor whose local overrides will used to redefine the style
Returns
kSuccess if the style was redefined, kFailure otherwise
virtual ErrorCode Facade::ICellStylesFacade::RenameCellStyle (const UIDRefwhichStyle,
const PMStringnewName 
) const
pure virtual

Renames a single cell style.

Parameters
whichStyle[IN] the cell style to rename
newName[IN] a valid, unique (within the style group context) name for the cell style
Returns
kSuccess if the style was renamed, kFailure otherwise
virtual ErrorCode Facade::ICellStylesFacade::SetDefaultStyle (const UIDRefdefaultStyle) const
pure virtual

Sets the default cell style. Currently the default cell style is not used.

Parameters
defaultStyle[IN] the cell style to use as the default
Returns
kSuccess if the default style was set, kFailure otherwise