![]() | InDesign SDK 20.5 |
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) |
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.
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. |
| inline |
Constructor.
| inlinevirtual |
Destructor.
| WideString SnpSortTable::GetTextContent | ( | const GridAddress & | gridAddress | ) |
Acquire the text content at specified {GridAddress}.
| gridAddress | specifies which cell is being targeted |
| void SnpSortTable::GetValuesInColumn | ( | K2Vector< WideString > & | vec, |
| const int32 | nCol | ||
| ) |
Acquire the values in specified column.
| vec | OUT parameter to hold the values from the given column |
| nCol | specifies colum of interest |
| void SnpSortTable::GetValuesInRow | ( | K2Vector< WideString > & | vec, |
| const int32 | nRow | ||
| ) |
Acquire the values in specified row.
| vec | OUT parameter which holds the values from the row given |
| nRow | specifies row of interest |
| void SnpSortTable::ModalSort | ( | SnpSortTable::eSortWhat | sortWhat, |
| bool16 | isAscending, | ||
| int32 | keyColumn | ||
| ) |
Performs a sort depending on the mode chosen.
| 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 | ( | ITableModel * | iTableModel | ) |
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.
| [in] | iTableModel | Table model to set. |
| void SnpSortTable::SetTextContent | ( | const GridAddress & | gridAddress, |
| const WideString & | text | ||
| ) |
Change the text content at the given {GridAddress}.
| gridAddress | specifies which cell is being targeted |
| text | specified new contents for given {GridAddress} |
| void SnpSortTable::SetValuesInColumn | ( | const K2Vector< WideString > & | vec, |
| const int32 | nCol | ||
| ) |
Change the values in the specified column.
| [in] | vec | contains new values for the given column |
| nCol | specifies column of interest |
| void SnpSortTable::SetValuesInRow | ( | const K2Vector< WideString > & | vec, |
| const int32 | nRow | ||
| ) |
Change the values in specified row.
| [in] | vec | contains the new text values for the row |
| nRow | specifies 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.
| isAscending | kTrue if the values should be sorted to ascending order, kFalse otherwise |
| keyColumn | specifies the column on whose ordering the whole table is sorted |
| void SnpSortTable::SortSingleColumn | ( | bool16 | isAscending, |
| const int32 | nCol | ||
| ) |
Sort one column independently of the rest of the table.
| isAscending | kTrue if the values should be sorted to ascending order, kFalse otherwise |
| nCol | identifies column to be sorted |