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

#include <ITableUtils.h>

Inheritance diagram for ITableUtils:
IPMUnknown

Classes

class  CellChunk
 

Public Types

enum  { kDefaultIID = IID_ITABLEUTILS }
 
enum  ESetTextSelection { eNoSelection, eSetSelectionInFirstCell }
 

Public Member Functions

virtual UIDRef ConvertTextToTable (ITextModel *textModel, const Text::StoryRange &textRange, const PMString colSeparator="\t", const PMString rowSeparator="\r", const int32 userNumCols=1, const UID &tableStyleUID=kInvalidUID) const =0
 
virtual UIDRef ConvertTextToTable (ITextModel *textModel, const Text::StoryRange &textRange, const K2Vector< PMString > &colSeparators, const K2Vector< PMString > &rowSeparators, const int32 userNumCols=1, const UID &tableStyleUID=kInvalidUID) const =0
 
virtual void InsertTable (ITextModel *textModel, TextIndex index, int32 len, int32 numRows, int32 numCols, const PMReal &rowHeight, const PMReal &colWidth, CellType cellType, const ESetTextSelection setSelection, const UID &tableStyle=kInvalidUID) const =0
 
virtual void InsertTable (ITextModel *textModel, TextIndex index, int32 len, int32 numRows, int32 numCols, int32 numHeaderRows, int32 numFooterRows, const PMReal &rowHeight, const PMReal &colWidth, CellType cellType, const ESetTextSelection setSelection, const UID &tableStyle=kInvalidUID, Tables::EDirection direction=Tables::eLTR) const =0
 
virtual UIDRef GetTableModel (ITextModel *text, TextIndex index) const =0
 
virtual UID GetRootTableStyle (IDataBase *db) const =0
 
virtual K2Vector< CellChunk > * GetCellChunks (const GridArea selection, const ITableModel *tableModel) const =0
 
virtual void CalculateDefaultCellBounds (const ITextModel *textModel, TextIndex insertLocation, int32 numRows, int32 numCols, PMReal &rowHeight, PMReal &colWidth) const =0
 
virtual Tables::ESelectionSides CalculateSides (const ITableTarget *tableTarget) const =0
 
virtual ErrorCode CreateCellScriptObject (const RequestContext &context, const GridArea &area, const ITableModel *tableModel, ScriptList *objectList)=0
 
virtual ErrorCode CreateCellScriptObject (const RequestContext &context, const GridArea &area, const ITableModel *tableModel, ScriptList *objectList, IScript *parent)=0
 
virtual ErrorCode CreateRowScriptObject (const RequestContext &context, GridCoord row, const ITableModel *tableModel, ScriptList *objectList, IScript *parent)=0
 
virtual ErrorCode CreateColumnScriptObject (const RequestContext &context, GridCoord col, const ITableModel *tableModel, ScriptList *objectList, IScript *parent)=0
 
virtual ErrorCode CreateTableScriptObject (const RequestContext &context, const ITableModel *tableModel, ScriptList *objectList)=0
 
virtual IScriptCreateTableScriptObject (const RequestContext &context, const ITableModel *tableModel)=0
 
virtual ErrorCode ProcessCreateTableStyle (const PMString &styleName, const AttributeBossList *styleAttributes, IDataBase *dbOfStyleNameTable, UID &outNewStyleUID) const =0
 
virtual bool16 IsStyleNamePresent (const PMString &styleName, IDataBase *dbOfStyleNameTable) const =0
 
virtual PMPoint ConvertToLocalPoint (const ITableFrame *tableFrame, const PBPMPoint &pt) const =0
 
virtual bool16 InsideTable (const ITextModel *textModel, TextIndex at) const =0
 
virtual TextIndex TableToPrimaryTextIndex (const ITextModel *textModel, TextIndex withinTableTextIndex) const =0
 
virtual RangeData TableToPrimaryTextRange (const ITextModel *textModel, RangeData tableRange) const =0
 
virtual bool16 DictGetIsComposable (const ITextStoryThreadDict *dict, uint32 dictKey) const =0
 
virtual ParcelKey DictGetParcelKeyOfControllingAnchor (const ITextStoryThreadDict *dict, uint32 dictKey, ParcelKey keyInChildThread) const =0
 
virtual GridArea FixUpTableSelection (const GridArea selection, const ITableModel *model) const =0
 
virtual bool16 CanInsertTableAt (const ITextModel *textModel, TextIndex at) const =0
 
virtual ParcelKey GetHFProxyParcelKey (const ICellContent *cell, ParcelKey key) const =0
 
virtual bool16 GetHFTextRangeContext (const ITextModel *textModel, TextIndex at, RangeData *pFrameBodyRange, RangeData *pTableBodyRange) const =0
 
virtual IPlaceBehaviorQueryPageItemCellPlaceBehavior (const ITableModel *tableModel, GridAddress cellAddress)=0
 
virtual IPlaceBehaviorQueryPageItemCellPlaceBehavior (UIDRef tableModel, GridAddress cellAddress)=0
 
virtual bool16 IsTableCellContent (const UIDRef &item, UID &pageItemAdapter) const =0
 
virtual bool16 IsTableCellContent (const UIDRef &item, UID *pageItemAdapter=nil)=0
 
virtual void ValidateContent (UIDList &items) const =0
 
virtual CellType GetCellContentType (UIDRef tableModel, GridAddress cellAddress) const =0
 
virtual ICellContentQueryCellContentfromPlacedItem (UIDRef placedItem) const =0
 
virtual bool16 CanConvertToGraphicCell (UIDRef tableModel, const GridAddress &cellAddress) const =0
 
virtual bool16 CanConvertInlineCellToImageCell (const ITableModel *table, const GridAddress &cell) const =0
 
virtual bool16 HasAnyTextCell (ITableModel *tableModel, const GridArea &area) const =0
 
virtual bool16 HasAnyGraphicCell (ITableModel *tableModel, const GridArea &area) const =0
 
virtual bool16 CanPlaceInGraphicCell (UIDRef item, ErrorCode *err=NULL) const =0
 
virtual ErrorCode ResizeTableFrame (ITableFrame *tableFrame, const PMReal &horizonProp, const PMReal &verticalProp)=0
 
virtual ErrorCode ResizeTableFrame (ITableFrame *tableFrame, PMRect tableArea, const int32 numRowsInFrame, const int32 numColumnsInFrame, ColRange columnsInFrame, const PMReal &horizonProp, const PMReal &verticalProp)=0
 
virtual void SetMinRowHeight (ITableModel *table, int32 row, int32 howMany, const PMReal &height)=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

Table related utility functions. Some of these are not new selection-architecture compliant and should be approached with caution.

Member Enumeration Documentation

Used to specify whether text caret should be placed in first cell when a new table is created.

Member Function Documentation

virtual void ITableUtils::CalculateDefaultCellBounds (const ITextModeltextModel,
TextIndex insertLocation,
int32 numRows,
int32 numCols,
PMRealrowHeight,
PMRealcolWidth 
) const
pure virtual

Calculate default sizes for cells in a table to be created. Attempts to calculate a reasonable sized bounding box for a table that might be placed in a textflow.

Parameters
textModelrefers to the text model into which this table might later be placed.
insertLocationspecifies the index within the text model where a table might be placed.
numRowscount of rows in prospective table
numColscount of columns in prospective table
rowHeight,out-parameter,holdsthe calculated row-height given the input
colWidth,out-parameter,holdsthe calculated column-width given the input
virtual Tables::ESelectionSides ITableUtils::CalculateSides (const ITableTargettableTarget) const
pure virtual

Determine how many sides in the selection are selected. This method attempts to calculate how many sides are selected, e.g. when applying strokes to the selection. Returns the sides which can be active in the selection Returns a Tables::ESelectionSides which represents the sides the selection contains

Parameters
tableTargetrefers to the table selection
Returns
the sides selected, as an ESelectionSides value
virtual bool16 ITableUtils::CanConvertInlineCellToImageCell (const ITableModeltable,
const GridAddresscell 
) const
pure virtual

Check if a text cell with inline, can be converted into a graphic cell with inline object placed inside it

Parameters
tableModeltable to query from
cellAddresscell to query for
Returns
kTrue if text cell with inline, can be converted into a graphic cell with inline object placed inside it
virtual bool16 ITableUtils::CanConvertToGraphicCell (UIDRef tableModel,
const GridAddresscellAddress 
) const
pure virtual

Check if any cell can be converted into graohic cell

Parameters
tableModeltable to query from
cellAddresscell to query for
Returns
kTrue if cell can be converted to graphic cell, otherwise kFalse
virtual bool16 ITableUtils::CanInsertTableAt (const ITextModeltextModel,
TextIndex at 
) const
pure virtual

Not all TextStoryThreads can properly host a Table. This method will tell the caller if the specified TextIndex and do so.

Parameters
textModel
TextIndex
Returns
kTrue if a Table may be inserted at the specified TextIndex.
virtual UIDRef ITableUtils::ConvertTextToTable (ITextModeltextModel,
const Text::StoryRangetextRange,
const PMString colSeparator = "\t",
const PMString rowSeparator = "\r",
const int32 userNumCols = 1,
const UIDtableStyleUID = kInvalidUID 
) const
pure virtual

Method to convert tab-delimited text into a table. Wrapper around execution of the kTextToTableCmdBoss command which simplifies process of converting delimited text into a table.

Parameters
textModelspecifies the text model containing text to convert to table
textRangedelimits the range of text characters to transform into table
colSeparatorspecifies delimiter for columns
rowSeparatorspecifies delimiter for rows
userNumColsspecifies number of columns in table if colSeparator equals rowSeparator, otherwise ignored
tableStyleUID[IN] optional, the table style to use for the new table, if this is kInvalidUID, the root table style is used
Returns
reference to the table created as UIDRef
virtual UIDRef ITableUtils::ConvertTextToTable (ITextModeltextModel,
const Text::StoryRangetextRange,
const K2Vector< PMString > & colSeparators,
const K2Vector< PMString > & rowSeparators,
const int32 userNumCols = 1,
const UIDtableStyleUID = kInvalidUID 
) const
pure virtual

Same as above method except params 3 and 4 are vectors of seperators instead of individual strings

Parameters
colSeparatorsvector of strings that can be used interchangably as seperators for the columns
rowSeparatorsvector of strings that can be used interchangably as seperators for the rows
virtual PMPoint ITableUtils::ConvertToLocalPoint (const ITableFrametableFrame,
const PBPMPointpt 
) const
pure virtual

Convert pasteboard points to table frames' local points. Used for hit testing so it has some small adjustments to the rect of table frame. Will constrain to table frame if within 3 units of table frame stroke bounding box. Currently used in TableFrameEventAction and TableFrameOwnedItemIBeamData

Parameters
tableFramepointer of the table frame
ptPasteboard coordinates
virtual ErrorCode ITableUtils::CreateCellScriptObject (const RequestContextcontext,
const GridAreaarea,
const ITableModeltableModel,
ScriptList * objectList 
)
pure virtual

Creates an instance of an object (e.g. of class kScriptCellRefBoss) that can be used to manipulate a region of a table.

Parameters
contextis the request context
areadelimits the area of interest within the table
tableModeltable of interest that this object will manipulate
objectListeffectively holds the [out] parameter, an interface ptr (of type IScript) is appended to this list
parentthe parent of the script DIFFERENCE IN TWO VERSIONS OF FUNCTION, one has this one doesn't
Returns
kSuccess if object could be created and appended to list, kFailure otherwise
virtual ErrorCode ITableUtils::CreateCellScriptObject (const RequestContextcontext,
const GridAreaarea,
const ITableModeltableModel,
ScriptList * objectList,
IScriptparent 
)
pure virtual
virtual ErrorCode ITableUtils::CreateColumnScriptObject (const RequestContextcontext,
GridCoord col,
const ITableModeltableModel,
ScriptList * objectList,
IScriptparent 
)
pure virtual
virtual ErrorCode ITableUtils::CreateRowScriptObject (const RequestContextcontext,
GridCoord row,
const ITableModeltableModel,
ScriptList * objectList,
IScriptparent 
)
pure virtual
virtual ErrorCode ITableUtils::CreateTableScriptObject (const RequestContextcontext,
const ITableModeltableModel,
ScriptList * objectList 
)
pure virtual
virtual IScript* ITableUtils::CreateTableScriptObject (const RequestContextcontext,
const ITableModeltableModel 
)
pure virtual
virtual bool16 ITableUtils::DictGetIsComposable (const ITextStoryThreadDictdict,
uint32 dictKey 
) const
pure virtual

Adobe internal use only. Do not use. Will be removed.

virtual GridArea ITableUtils::FixUpTableSelection (const GridArea selection,
const ITableModelmodel 
) const
pure virtual

This is the code which cleans up a selection area into a selection which best represents the selection which is drawn It does 2 things, the first is to Shrink the selection to the first anchor and the last anchor selected, the second is to fix up the selection so it contains as many whole cells as possible (if you select 2 adjacent anchors of congruent anchors it will extend the selection to contain both whole cells)

virtual K2Vector<CellChunk>* ITableUtils::GetCellChunks (const GridArea selection,
const ITableModeltableModel 
) const
pure virtual

Takes the given GridArea and turns it into chunks of complete cells.

Parameters
selectionspecifies the area of the table that is to be turned into cell-chunks.
tableModelrefers to the table model from which the cells are going to be chunked.
Returns
collection of areas, each of which is a complete cell
virtual CellType ITableUtils::GetCellContentType (UIDRef tableModel,
GridAddress cellAddress 
) const
pure virtual

Get the cell type of any specific cell

Parameters
tableModeltbale to query from
cellAddresscell to query for
Returns
CellType the cell type of specified cell.
virtual ParcelKey ITableUtils::GetHFProxyParcelKey (const ICellContentcell,
ParcelKey key 
) const
pure virtual
Parameters
cellPointer to TextCell boss.
keyOf the Parcel containing the text content
Returns
ParcelKey of the actual Parcel context.
virtual bool16 ITableUtils::GetHFTextRangeContext (const ITextModeltextModel,
TextIndex at,
RangeDatapFrameBodyRange,
RangeDatapTableBodyRange 
) const
pure virtual

This method provides context information for a TextIndex which is in a Header or Footer cell. If it returns kTrue, then pFrameBodyRange will be set to the Text Range of the drawing TableFrame.

Parameters
textModel
at
pFrameBodyRangePointer to RangeData that will be filled in with drawing TableFrames body rows.
pTableBodyRangePointer to RangeData that will be filled in with Table's Text range.
Returns
kTrue if the specified TextIndex is in a Header/Footer cell.
virtual UID ITableUtils::GetRootTableStyle (IDataBasedb) const
pure virtual

Query for root table style by UID.

Precondition
db <> nil
Returns
UID of root style, kInvalidUID otherwise.
virtual UIDRef ITableUtils::GetTableModel (ITextModeltext,
TextIndex index 
) const
pure virtual

Acquire a table model ref given a text model and a starting point in the text model.

Attempts to return a persistent reference (UIDRef) for a table model, given a text model and an index within the model that is located within a story thread for a cell in the table. Will find a table model if the index is inside of a cell. Will find a table model if index points to a frame anchor or points to an anchor character embedded inside a frame anchor.

Parameters
textreference to text model that contains a table
indexshould be an index in the text model that is text within a cell
Precondition
text <> nil
index >= 0 && index < text.TotalLength()
Postcondition
 ownedItemStrand = text.QueryInterface(IID_IITEMSTRAND)

                result <> UIDRef::gNull implies

                indices->exists(i | ownedItemStrand.GetOwnedUID(i, kFrameAnchorBoss) <> kInvalidUID

                result = UIDRef::gNull implies

                ownedItemStrand.GetOwnedUID(index, kFrameAnchorBoss) = kInvalidUID
virtual bool16 ITableUtils::HasAnyGraphicCell (ITableModeltableModel,
const GridAreaarea 
) const
pure virtual

Returns kTrue if there is any graphic cell in the grid area specified, kFalse otherwise

Parameters
tableModeltableModel to query from
areaGridArea of cells to query for
Returns
bool16 Returns kTrue if there is any graphic cell in that grid area
virtual bool16 ITableUtils::HasAnyTextCell (ITableModeltableModel,
const GridAreaarea 
) const
pure virtual

Returns kTrue if there is any text cell in the grid area specified, kFalse otherwise

Parameters
tableModeltableModel to query from
areaGridArea of cells to query for
Returns
bool16 Returns kTrue if there is any text cell in that grid area
virtual void ITableUtils::InsertTable (ITextModeltextModel,
TextIndex index,
int32 len,
int32 numRows,
int32 numCols,
const PMRealrowHeight,
const PMRealcolWidth,
CellType cellType,
const ESetTextSelection setSelection,
const UIDtableStyle = kInvalidUID 
) const
pure virtual

Method to insert a table into a text flow. Height is measured in points. If rowHeight = 0.0 then the row height is determined by the size of the content because auto-grow is on for all rows. A non zero value of height will result in all rows having that minimum height.

Parameters
textModelrefers to the text model into which this table might later be placed.
indexindex within the text model for the start of the span to be replaced
lenspan of characters in the model to be replaced by the table
numRowsspecifies number of rows in the new table
numColsspecifies number of columns in the new tables
rowHeightspecifies the desired row height in points
colWidthspecifies the desired row height in points
cellTypespecifies type of cell, e.g. kTextCellContentType
setSelectionspecifies whether caret is going to be in first cell or not
tableStyle[IN], optional the table style to use for the new table, if this is kInvalidUID the root table style will be used
Precondition
textModel <> nil
len >= 0
index >= 0 and index+len < threadStart + threadspan
numRows >= 0 and numCols >= 0
rowHeight >= 0.0 and colWidth > 0.0
Postcondition
self.GetTableModel(textModel, index) <> UIDRef::gNull
virtual void ITableUtils::InsertTable (ITextModeltextModel,
TextIndex index,
int32 len,
int32 numRows,
int32 numCols,
int32 numHeaderRows,
int32 numFooterRows,
const PMRealrowHeight,
const PMRealcolWidth,
CellType cellType,
const ESetTextSelection setSelection,
const UIDtableStyle = kInvalidUID,
Tables::EDirection direction = Tables::eLTR 
) const
pure virtual

Same as above, only this takes three addition parameters. Two after the number of rows and columns – the number of headers and footers One after tableStyle-

Parameters
directionspecifies direction of table
virtual bool16 ITableUtils::InsideTable (const ITextModeltextModel,
TextIndex at 
) const
pure virtual

Return whether the given text index is within a table or not.

Parameters
textModelspecifies the text model containing the table
atthe TextIndex in question.
virtual bool16 ITableUtils::IsStyleNamePresent (const PMStringstyleName,
IDataBasedbOfStyleNameTable 
) const
pure virtual

Returns kTrue if a table style with styleName exists in ITableStyleNameTable on the workspace associated with the database dbOfStyleNameTable.

Parameters
styleNameName of style to check for
dbOfStyleNameTableDatabase whose associated workspace should be checked
virtual bool16 ITableUtils::IsTableCellContent (const UIDRefitem,
UIDpageItemAdapter 
) const
pure virtual

This method checks is item is inside any table cell.

Parameters
itemwhich we want
Returns
kTrue if item is inside table cell
UID of pageItemAdapterBoss. See IPageItemAdapter for more details
virtual bool16 ITableUtils::IsTableCellContent (const UIDRefitem,
UIDpageItemAdapter = nil 
)
pure virtual

This method checks is item is inside any table cell.

Parameters
itemwhich we want
Returns
kTrue if item is inside table cell
UID of pageItemAdapterBoss if valid pointer. See IPageItemAdapter for more details
virtual ErrorCode ITableUtils::ProcessCreateTableStyle (const PMStringstyleName,
const AttributeBossListstyleAttributes,
IDataBasedbOfStyleNameTable,
UIDoutNewStyleUID 
) const
pure virtual

Creates a new table style and adds it to the table style name table.

Parameters
styleNameName of the style. Should be non empty. Style name strings are not tranlsated. Pre: self.IsStyleNamePresent(styleName) == kFalse
styleAttributesAttributes of the table style. All attributes in the list should an ITableAttrReport implementaion.
dbOfStyleNameTableThe style is owned by the style name table that's on the workspace boss of this database.
outNewStyleUIDOut argument. If return is kSuccess this is the tUID of the table style created.
virtual ICellContent* ITableUtils::QueryCellContentfromPlacedItem (UIDRef placedItem) const
pure virtual

This method first checks if placed item is placed in a cell. If yes, then it will return pointer to it's ICellContent.

Parameters
Refof item placed in cell.
virtual IPlaceBehavior* ITableUtils::QueryPageItemCellPlaceBehavior (const ITableModeltableModel,
GridAddress cellAddress 
)
pure virtual

This method first triggers the conversion of cell to a graphic cell, if it is not a graphic cell. Then, it finds out the object inside page item cell & returns it place behavior. This API is use to directly place an object inside text cell

Parameters
tableModelwhose place behavior we wish to know
Returns
place behavior of object inside page item cell
virtual IPlaceBehavior* ITableUtils::QueryPageItemCellPlaceBehavior (UIDRef tableModel,
GridAddress cellAddress 
)
pure virtual

This method first triggers the conversion of cell to a graphic cell, if it is not a graphic cell. Then, it finds out the object inside page item cell & returns it place behavior. This API is use to directly place an object inside text cell

Parameters
tableModelwhose place behavior we wish to know
Returns
place behavior of object inside page item cell
virtual TextIndex ITableUtils::TableToPrimaryTextIndex (const ITextModeltextModel,
TextIndex withinTableTextIndex 
) const
pure virtual

Return the text index (in the primary story thread) of the anchor representing the table which contains the given text index. If the text index parameter is not in a table, the unchanged parameter is the return value.

Parameters
textModelspecifies the text model containing the table
withinTableTextIndexthe TextIndex in question - must be within a table.
virtual RangeData ITableUtils::TableToPrimaryTextRange (const ITextModeltextModel,
RangeData tableRange 
) const
pure virtual

Return the text range (in the primary story thread) of the anchor representing the table which contains the given text range. If the range parameter is not in a table, the unchanged parameter is the return value.

Parameters
textModelspecifies the text model containing the table
tableRangethe range in question - must be within a table.
virtual void ITableUtils::ValidateContent (UIDListitems) const
pure virtual

This method performs validation on content of page item cells. i.e if they have valid bounds or not. And if not, then it will ask cell to have minimum size bounds.

Parameters
itemslist of items to validate