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

Classes

class  TblSortComparator_rows
 
class  TblSortRowData
 

Public Types

enum  eSortWhat { eSortSingleColumn, eSortAllColumns }
 

Public Member Functions

 SnpSortTable ()
 
virtual ~SnpSortTable ()
 
void SetTableModel (ITableModel *iTableModel)
 
void ReleaseTableModel (void)
 
void ModalSort (SnpSortTable::eSortWhat sortWhat, bool16 isAscending, int32 keyColumn)
 
void SortSingleColumn (bool16 isAscending, const int32 nCol)
 
void SortMultiColumns (bool16 isAscending, int32 keyColumn)
 
void GetValuesInColumn (K2Vector< WideString > &vec, const int32 nCol)
 
void SetValuesInColumn (const K2Vector< WideString > &vec, const int32 nCol)
 
void GetValuesInRow (K2Vector< WideString > &vec, const int32 nRow)
 
void SetValuesInRow (const K2Vector< WideString > &vec, const int32 nRow)
 
WideString GetTextContent (const GridAddress &gridAddress)
 
void SetTextContent (const GridAddress &gridAddress, const WideString &text)
 

Detailed Description

  • How to sort the body text in a table in different ways.
    You first select if you want to sort a single body column in a table, or all columns in a table.
    
    
    
    Then you specify if you want to sort in ascending or descending order.
    
    
    
    After that, you specify which column you want to sort by. This becomes the "key column" for 
    
    the all-columns sorting operation, which means that if you sort all columns in a table, it is the order 
    
    of the contents in this column that determine the row order of content in other columns.
    
    
    
    For instance, say you have a table like this:
    
    
    
    | C | some data | some more data |
    
    | Z | some other data | some more other data |
    
    | A | some really different data | some more different data |
    
    | B | some kind of data | some other kind of data |
    
    
    and you want to sort all columns. If you set the "key column" to column 0 and perform the sort, the end result is this:
    
    | A | some really different data | some more different data |
    
    | B | some kind of data | some other kind of data |
    
    | C | some data | some more data |
    
    | Z | some other data | some more other data |
    
    
    Note that data in other columns move together by rows.

Member Enumeration Documentation

Used to specify the type of sort. Whether to sort a single column, or to sort all the columns (with sort order determined by a 'key' column)
Enumerator
eSortSingleColumn 

For a single column sort. Content in other columns are not affected.

eSortAllColumns 

To specify that all the columns should be sorted but with one key column. See comments for the SnpSortTable class about sorting with a key column.

Constructor & Destructor Documentation

SnpSortTable::SnpSortTable ()
inline

Constructor.

virtual SnpSortTable::~SnpSortTable ()
inlinevirtual

Destructor.

Member Function Documentation

WideString SnpSortTable::GetTextContent (const GridAddressgridAddress)

Acquire the text content at specified {GridAddress}.

Parameters
gridAddressspecifies which cell is being targeted
Returns
text content at given address as {WideString}
void SnpSortTable::GetValuesInColumn (K2Vector< WideString > & vec,
const int32 nCol 
)

Acquire the values in specified column.

Parameters
vecOUT parameter to hold the values from the given column
nColspecifies colum of interest
void SnpSortTable::GetValuesInRow (K2Vector< WideString > & vec,
const int32 nRow 
)

Acquire the values in specified row.

Parameters
vecOUT parameter which holds the values from the row given
nRowspecifies row of interest
void SnpSortTable::ModalSort (SnpSortTable::eSortWhat sortWhat,
bool16 isAscending,
int32 keyColumn 
)

Performs a sort depending on the mode chosen.

Parameters
sortWhat
isAscending
keyColumn
void SnpSortTable::ReleaseTableModel (void )

Releases the table model. This must be called after ALL of the other methods are called, so that the table model is cleaned up properly. Doing this in the destructor of this class is too late, since the InDesign boss cleanup checks run before all global objects are deleted by the runtime engine.

void SnpSortTable::SetTableModel (ITableModeliTableModel)

Sets the table model. This must be called before any of the other methods are called, so that the table model is set up properly.

Parameters
[in]iTableModelTable model to set.
void SnpSortTable::SetTextContent (const GridAddressgridAddress,
const WideStringtext 
)

Change the text content at the given {GridAddress}.

Parameters
gridAddressspecifies which cell is being targeted
textspecified new contents for given {GridAddress}
void SnpSortTable::SetValuesInColumn (const K2Vector< WideString > & vec,
const int32 nCol 
)

Change the values in the specified column.

Parameters
[in]veccontains new values for the given column
nColspecifies column of interest
void SnpSortTable::SetValuesInRow (const K2Vector< WideString > & vec,
const int32 nRow 
)

Change the values in specified row.

Parameters
[in]veccontains the new text values for the row
nRowspecifies which row to change contents of
void SnpSortTable::SortMultiColumns (bool16 isAscending,
int32 keyColumn 
)

Sort the whole table, with an order determined by that in the keyColumn.

Parameters
isAscendingkTrue if the values should be sorted to ascending order, kFalse otherwise
keyColumnspecifies the column on whose ordering the whole table is sorted
Precondition
keyColumn in range of columns indicated by colRange
void SnpSortTable::SortSingleColumn (bool16 isAscending,
const int32 nCol 
)

Sort one column independently of the rest of the table.

Parameters
isAscendingkTrue if the values should be sorted to ascending order, kFalse otherwise
nColidentifies column to be sorted