#include <ie_Table.h>
ie_imp_table::ie_imp_table | ( | PD_Document * | pDoc | ) |
Class for handling import of tables. Built for RTF but might be useful elsewhere.
References UT_GenericVector< T >::clear(), m_sTableProps, m_vecCells, and m_vecCellX.
ie_imp_table::~ie_imp_table | ( | void | ) | [virtual] |
References _removeAllStruxes(), m_bTableUsed, m_vecCells, UT_VECTOR_PURGEALL, and xxx_UT_DEBUGMSG.
void ie_imp_table::_buildCellXVector | ( | void | ) | [private] |
Build a vector of all the cellx's and sort them
References UT_GenericVector< T >::addItem(), UT_GenericVector< T >::clear(), compareCellX(), UT_GenericVector< T >::findItem(), ie_imp_cell::getCellX(), UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), m_vecCells, m_vecCellX, and UT_GenericVector< T >::qsort().
Referenced by buildTableStructure(), and NewRow().
void ie_imp_table::_removeAllStruxes | ( | void | ) | [private] |
This method removes all the struxes placed in the document. It is called if the table is never actually used.
References PD_Document::deleteStruxNoUpdate(), ie_imp_cell::getCellSDH(), UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), m_pDoc, m_tableSDH, m_vecCells, and UT_DEBUGMSG.
Referenced by ~ie_imp_table().
void ie_imp_table::appendRow | ( | UT_GenericVector< ie_imp_cell * > * | pVecRowOfCells | ) |
Append the row of cells given by the vector pVecRowOfCells to the current table, adjusting hte table pointer and row in the cell classes
References UT_GenericVector< T >::addItem(), UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), m_iRowCounter, m_vecCells, ie_imp_cell::setImpTable(), and ie_imp_cell::setRow().
Referenced by ie_imp_table_control::NewRow().
void ie_imp_table::buildTableStructure | ( | void | ) |
This method bulds the table structure as required by abiword. ie It sets all the left-attach, right-attach etc.
References _buildCellXVector(), getCellAtRowColX(), ie_imp_cell::getCellX(), getColNumber(), UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), ie_imp_cell::getRow(), ie_imp_cell::isFirstVerticalMerged(), ie_imp_cell::isMergedAbove(), ie_imp_cell::isMergedLeft(), m_vecCells, ie_imp_cell::setBot(), ie_imp_cell::setLeft(), ie_imp_cell::setRight(), ie_imp_cell::setTop(), UT_ASSERT_HARMLESS, UT_DEBUGMSG, and xxx_UT_DEBUGMSG.
Referenced by ie_imp_table_control::CloseTable(), and ie_imp_table_control::~ie_imp_table_control().
void ie_imp_table::CloseCell | ( | void | ) |
References m_bTableUsed.
Referenced by ie_imp_table_control::CloseCell(), IE_Imp_RTF::HandleCell(), and ie_imp_table_control::NewRow().
void ie_imp_table::deleteRow | ( | UT_sint32 | row | ) |
This method removes the cells in the row given.
References PD_Document::appendStrux(), UT_GenericVector< T >::deleteNthItem(), PD_Document::deleteStruxNoUpdate(), ie_imp_cell::getCellSDH(), ie_imp_cell::getCellX(), PD_Document::getEndCellStruxFromCellSDH(), UT_GenericVector< T >::getItemCount(), PD_Document::getLastStruxOfType(), ie_imp_cell::getLeft(), PD_Document::getNextStrux(), UT_GenericVector< T >::getNthItem(), ie_imp_cell::getRow(), m_bNewRow, m_bTableUsed, m_iCellXOnRow, m_iPosOnRow, m_pDoc, m_vecCells, PTX_Block, PTX_EndCell, PTX_SectionCell, and UT_DEBUGMSG.
Referenced by removeCurrentRow(), and removeOnThisCellRow().
bool ie_imp_table::doCellXMatch | ( | UT_sint32 | iCellX1, | |
UT_sint32 | iCellX2, | |||
bool | bIsLast = false | |||
) | [static] |
Referenced by getCellAtRowColX(), getColNumber(), and NewRow().
ie_imp_cell * ie_imp_table::getCellAtRowColX | ( | UT_sint32 | newRow, | |
UT_sint32 | cellX | |||
) | const |
References doCellXMatch(), ie_imp_cell::getCellX(), UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), ie_imp_cell::getRow(), and m_vecCells.
Referenced by buildTableStructure(), and IE_Imp_RTF::HandleCellX().
std::string ie_imp_table::getCellPropVal | ( | const std::string & | psProp | ) | const |
Return the value of a property of the current cell. This should be deleted when you've finished with it.
References ie_imp_cell::getPropVal(), m_pCurImpCell, and UT_return_val_if_fail.
UT_sint32 ie_imp_table::getCellXOnRow | ( | void | ) | const [inline] |
UT_sint32 ie_imp_table::getColNumber | ( | ie_imp_cell * | pImpCell | ) | const |
Returns column number plus 1 of the cell.
References doCellXMatch(), ie_imp_cell::getCellX(), UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), m_vecCellX, and xxx_UT_DEBUGMSG.
Referenced by buildTableStructure().
ie_imp_cell * ie_imp_table::getCurCell | ( | void | ) | const |
ie_imp_cell * ie_imp_table::getNthCellOnRow | ( | UT_sint32 | iCell | ) | const |
This method scans the vector of cell looking for the nth cell on the current row Return null if cell is not present.
References UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), ie_imp_cell::getRow(), m_iRowCounter, and m_vecCells.
Referenced by IE_Imp_RTF::HandleCell(), IE_Imp_RTF::HandleCellX(), and NewRow().
UT_sint32 ie_imp_table::getNumRows | ( | void | ) | const |
Return the number of rows in the table
References UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), ie_imp_cell::getRow(), and m_vecCells.
UT_sint32 ie_imp_table::getPosOnRow | ( | void | ) | const [inline] |
std::string ie_imp_table::getPropVal | ( | const char * | szProp | ) | const |
Return the value of a property of this table. This should be deleted when you've finished with it.
References m_sTableProps, and UT_std_string_getPropVal().
std::string ie_imp_table::getPropVal | ( | const std::string & | psProp | ) | const |
Return the value of a property of this table. This should be deleted when you've finished with it.
References m_sTableProps, and UT_std_string_getPropVal().
Referenced by writeTablePropsInDoc().
UT_sint32 ie_imp_table::getRow | ( | void | ) | const [inline] |
Referenced by IE_Imp_RTF::HandleCell(), IE_Imp_RTF::HandleCellX(), and ie_imp_table_control::NewRow().
pf_Frag_Strux * ie_imp_table::getTableSDH | ( | void | ) | const |
Return this tables SDH
References m_tableSDH.
bool ie_imp_table::getVecOfCellsOnRow | ( | UT_sint32 | row, | |
UT_GenericVector< ie_imp_cell * > * | pVec | |||
) | const |
Returns a vector of pointers to cells on the requested row. pVec should be empty initially.
References UT_GenericVector< T >::addItem(), ie_imp_cell::getCellX(), UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), ie_imp_cell::getRow(), m_vecCells, and xxx_UT_DEBUGMSG.
Referenced by IE_Imp_RTF::HandleCell(), ie_imp_table_control::NewRow(), and NewRow().
void ie_imp_table::incCellXOnRow | ( | void | ) | [inline] |
Referenced by IE_Imp_RTF::HandleCellX().
void ie_imp_table::incPosOnRow | ( | void | ) | [inline] |
Referenced by IE_Imp_RTF::HandleCell().
bool ie_imp_table::isAutoFit | ( | void | ) | const [inline] |
Referenced by ie_imp_table_control::NewRow().
bool ie_imp_table::isNewRow | ( | void | ) | const [inline] |
UT_sint32 ie_imp_table::NewRow | ( | void | ) |
Start a new row.
References _buildCellXVector(), UT_GenericVector< T >::clear(), ie_imp_cell::copyCell(), doCellXMatch(), ie_imp_cell::getCellX(), UT_GenericVector< T >::getItemCount(), getNthCellOnRow(), UT_GenericVector< T >::getNthItem(), getVecOfCellsOnRow(), m_bNewRow, m_iCellXOnRow, m_iPosOnRow, m_iRowCounter, m_pCurImpCell, m_vecCellX, and UT_DEBUGMSG.
Referenced by ie_imp_table_control::NewRow().
UT_sint32 ie_imp_table::OpenCell | ( | void | ) |
Open a new cell.
References UT_GenericVector< T >::addItem(), UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), ie_imp_cell::getRow(), m_bNewRow, m_iRowCounter, m_pCurImpCell, m_pDoc, and m_vecCells.
Referenced by IE_Imp_RTF::HandleCell(), IE_Imp_RTF::HandleCellX(), ie_imp_table_control::OpenCell(), and IE_Imp_RTF::OpenTable().
void ie_imp_table::removeCurrentRow | ( | void | ) |
This method removes the current row.
References deleteRow(), m_iRowCounter, and UT_DEBUGMSG.
Referenced by IE_Imp_RTF::HandleRow().
void ie_imp_table::removeExtraneousCells | ( | void | ) |
This method scans the vector of cells and removes cells and their sdh's if they do no have cellx defined.
References UT_GenericVector< T >::deleteNthItem(), PD_Document::deleteStruxNoUpdate(), ie_imp_cell::getCellSDH(), ie_imp_cell::getCellX(), UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), m_pDoc, and m_vecCells.
void ie_imp_table::removeOnThisCellRow | ( | ie_imp_cell * | pImpCell | ) |
This method removes all cells on the same row as this. Can happen if a document inserts a well defined row but puts in no 's
References deleteRow(), ie_imp_cell::getLeft(), ie_imp_cell::getRow(), ie_imp_cell::getTop(), and UT_DEBUGMSG.
bool ie_imp_table::removeRow | ( | UT_sint32 | row | ) |
Remove all the cells in row identified by row from the table vector of cells. Do not delete the cell classes, they will be usde later.
References UT_GenericVector< T >::deleteNthItem(), UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), ie_imp_cell::getRow(), m_vecCells, and xxx_UT_DEBUGMSG.
Referenced by ie_imp_table_control::NewRow().
void ie_imp_table::setAutoFit | ( | bool | bVal | ) | [inline] |
Referenced by IE_Imp_RTF::FlushTableProps(), ie_imp_table_control::NewRow(), and IE_Imp_RTF::TranslateKeywordID().
void ie_imp_table::setCell | ( | ie_imp_cell * | pCell | ) | [inline] |
Referenced by IE_Imp_RTF::HandleCellX().
void ie_imp_table::setCellProp | ( | const std::string & | psProp, | |
const std::string & | psVal | |||
) |
Set a property in the current cell properties string.
References m_pCurImpCell, ie_imp_cell::setProp(), and UT_return_if_fail.
Set the current cell to that at row row and at position col past the first cell on this row.
References UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), ie_imp_cell::getRow(), m_pCurImpCell, m_vecCells, UT_ASSERT_HARMLESS, and xxx_UT_DEBUGMSG.
Referenced by setNthCellOnThisRow().
void ie_imp_table::setCellX | ( | UT_sint32 | cellx | ) |
Set this cell to have the cellx value given.
References m_pCurImpCell, ie_imp_cell::setCellX(), and UT_return_if_fail.
Referenced by IE_Imp_RTF::HandleCellX().
void ie_imp_table::setCellXOnRow | ( | UT_sint32 | cellxOnRow | ) | [inline] |
void ie_imp_table::setNthCellOnThisRow | ( | UT_sint32 | iCell | ) |
set the current cell to the nth (iCell) location on the current row.
References m_iRowCounter, and setCellRowNthCell().
Referenced by IE_Imp_RTF::HandleCell().
void ie_imp_table::setPosOnRow | ( | UT_sint32 | posOnRow | ) | [inline] |
Referenced by IE_Imp_RTF::HandleCell().
void ie_imp_table::setProp | ( | const std::string & | psProp, | |
const std::string & | psVal | |||
) |
Set a property in the table properties string.
References m_sTableProps, and UT_std_string_setProperty().
Referenced by IE_Imp_RTF::TranslateKeywordID(), and writeTablePropsInDoc().
void ie_imp_table::setProp | ( | const char * | szProp, | |
const char * | szVal | |||
) |
Set a property in the table properties string.
References m_sTableProps, and UT_std_string_setProperty().
void ie_imp_table::setTableSDH | ( | pf_Frag_Strux * | sdh | ) |
Set the SDH for this table
References m_tableSDH, and xxx_UT_DEBUGMSG.
Referenced by ie_imp_table_control::NewRow(), and IE_Imp_RTF::OpenTable().
bool ie_imp_table::wasTableUsed | ( | void | ) | const [inline] |
Referenced by ie_imp_table_control::CloseTable(), and ie_imp_table_control::~ie_imp_table_control().
void ie_imp_table::writeAllCellPropsInDoc | ( | void | ) |
Write out all the properties in all the cells to the PieceTable
References PD_Document::deleteStruxNoUpdate(), ie_imp_cell::getBot(), ie_imp_cell::getCellSDH(), UT_GenericVector< T >::getItemCount(), ie_imp_cell::getLeft(), PD_Document::getNextStrux(), UT_GenericVector< T >::getNthItem(), ie_imp_cell::getRight(), ie_imp_cell::getRow(), PD_Document::getStruxType(), ie_imp_cell::getTop(), ie_imp_cell::isMergedAbove(), ie_imp_cell::isMergedLeft(), ie_imp_cell::isMergedRight(), m_pDoc, m_vecCells, UT_ASSERT_HARMLESS, UT_DEBUGMSG, UT_return_if_fail, UT_SHOULD_NOT_HAPPEN, and ie_imp_cell::writeCellPropsInDoc().
Referenced by ie_imp_table_control::CloseTable(), and ie_imp_table_control::~ie_imp_table_control().
void ie_imp_table::writeTablePropsInDoc | ( | void | ) |
Write out all the properties in the properties string to the tableSDH
References PD_Document::changeStruxAttsNoUpdate(), DIM_IN, UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), getPropVal(), m_bAutoFit, m_pDoc, m_sTableProps, m_tableSDH, m_vecCellX, setProp(), UT_convertToInches(), UT_formatDimensionString(), UT_return_if_fail, and xxx_UT_DEBUGMSG.
Referenced by ie_imp_table_control::CloseTable(), and ie_imp_table_control::~ie_imp_table_control().
bool ie_imp_table::m_bAutoFit [private] |
Referenced by writeTablePropsInDoc().
bool ie_imp_table::m_bNewRow [private] |
Referenced by deleteRow(), NewRow(), and OpenCell().
bool ie_imp_table::m_bTableUsed [private] |
Referenced by CloseCell(), deleteRow(), and ~ie_imp_table().
UT_sint32 ie_imp_table::m_iCellXOnRow [private] |
Referenced by deleteRow(), and NewRow().
UT_sint32 ie_imp_table::m_iPosOnRow [private] |
Referenced by deleteRow(), and NewRow().
UT_sint32 ie_imp_table::m_iRowCounter [private] |
Referenced by appendRow(), getNthCellOnRow(), NewRow(), OpenCell(), removeCurrentRow(), and setNthCellOnThisRow().
ie_imp_cell* ie_imp_table::m_pCurImpCell [private] |
Referenced by getCellPropVal(), getCurCell(), NewRow(), OpenCell(), setCellProp(), setCellRowNthCell(), and setCellX().
PD_Document* ie_imp_table::m_pDoc [private] |
Referenced by _removeAllStruxes(), deleteRow(), OpenCell(), removeExtraneousCells(), writeAllCellPropsInDoc(), and writeTablePropsInDoc().
std::string ie_imp_table::m_sTableProps [private] |
Referenced by getPropVal(), ie_imp_table(), setProp(), and writeTablePropsInDoc().
pf_Frag_Strux* ie_imp_table::m_tableSDH [private] |
Referenced by _removeAllStruxes(), getTableSDH(), setTableSDH(), and writeTablePropsInDoc().
UT_GenericVector<ie_imp_cell*> ie_imp_table::m_vecCells [private] |
Referenced by _buildCellXVector(), _removeAllStruxes(), appendRow(), buildTableStructure(), deleteRow(), getCellAtRowColX(), getNthCellOnRow(), getNumRows(), getVecOfCellsOnRow(), ie_imp_table(), OpenCell(), removeExtraneousCells(), removeRow(), setCellRowNthCell(), writeAllCellPropsInDoc(), and ~ie_imp_table().
UT_NumberVector ie_imp_table::m_vecCellX [private] |
Referenced by _buildCellXVector(), getColNumber(), ie_imp_table(), NewRow(), and writeTablePropsInDoc().
UT_NumberVector ie_imp_table::m_vecSavedX [private] |