#include <fl_Squiggles.h>
fl_Squiggles::fl_Squiggles | ( | fl_BlockLayout * | pOwner, | |
FL_SQUIGGLE_TYPE | iType | |||
) |
Constructor
pOwner | The owning block |
fl_Squiggles::~fl_Squiggles | ( | void | ) | [virtual] |
Destructor
Only purges the vector. It is assumed the squiggles have already been cleared from the screen.
References _purge().
bool fl_Squiggles::_deleteAtOffset | ( | UT_sint32 | iOffset | ) | [private] |
Delete squiggle at offset
iOffset | Offset |
If a squiggle spans the offset, delete it.
References _deleteNth(), _find(), _getCount(), FL_SQUIGGLE_GRAMMAR, getNth(), getSquiggleType(), and xxx_UT_DEBUGMSG.
Referenced by join(), split(), textInserted(), and textRevised().
void fl_Squiggles::_deleteNth | ( | UT_sint32 | iIndex | ) | [private] |
Delete Nth squiggle
iIndex | Index of squiggle to delete Clear squiggle from screen and g_free the POB's memory |
References clear(), getNth(), m_vecSquiggles, and xxx_UT_DEBUGMSG.
Referenced by _deleteAtOffset(), add(), deleteAll(), recheckIgnoredWords(), and textDeleted().
Find squiggle spanning offset
iOffset | Offset |
References _getCount(), getNth(), and xxx_UT_DEBUGMSG.
Referenced by _deleteAtOffset(), and get().
Find first squiggle after the given offset
iOffset | Offset |
This function should be rewritten using binary search
References _getCount(), and getNth().
Referenced by add(), and findRange().
UT_sint32 fl_Squiggles::_getCount | ( | void | ) | const [inline, private] |
Referenced by _deleteAtOffset(), _find(), _findFirstAfter(), _move(), add(), deleteAll(), findRange(), and recheckIgnoredWords().
void fl_Squiggles::_move | ( | UT_sint32 | iOffset, | |
UT_sint32 | chg, | |||
fl_BlockLayout * | pNewBlock = NULL | |||
) | [private] |
Move squiggles to new block
iOffset | Offset at which to split | |
chg | Offset change. If >0 it's a new absolute position, if <0 it's relative to the current offset. | |
pNewBlock | New block the squiggles should be moved to, or NULL to keep them in the current block. |
Move existing squiggles to reflect insert/delete at iOffset. All subsequent squiggles should be switched to (non-null) pBlock.
References _getCount(), fl_ContainerLayout::add(), clear(), getNth(), m_pOwner, m_vecSquiggles, UT_ASSERT, and xxx_UT_DEBUGMSG.
Referenced by join(), split(), textDeleted(), and textInserted().
void fl_Squiggles::_purge | ( | void | ) | [private] |
Purge squiggles Purges the squiggle list. This does not clear the squiggles on the display.
References m_vecSquiggles.
Referenced by ~fl_Squiggles().
void fl_Squiggles::add | ( | const fl_PartOfBlockPtr & | pPOB | ) |
Add squiggle
POB | for squiggle Insert POB sorted by offset in vector. |
References _deleteNth(), _findFirstAfter(), _getCount(), FL_SQUIGGLE_SPELL, getNth(), getSquiggleType(), m_vecSquiggles, markForRedraw(), UT_ASSERT, and xxx_UT_DEBUGMSG.
void fl_Squiggles::clear | ( | const fl_PartOfBlockPtr & | pPOB | ) |
Clear squiggle
pPOB | Part of block to clear squiggle for This clears the squiggle graphics from the screen. |
References FV_View::_clearBetweenPositions(), PD_Document::getBounds(), fl_BlockLayout::getDocLayout(), fl_Layout::getDocument(), FV_View::getDocument(), fl_BlockLayout::getPosition(), FL_DocLayout::getView(), fl_ContainerLayout::isOnScreen(), AD_Document::isPieceTableChanging(), m_pOwner, markForRedraw(), and xxx_UT_DEBUGMSG.
Referenced by _deleteNth(), and _move().
bool fl_Squiggles::deleteAll | ( | void | ) |
Delete all squiggles
References _deleteNth(), _getCount(), and xxx_UT_DEBUGMSG.
bool fl_Squiggles::findRange | ( | UT_sint32 | iStart, | |
UT_sint32 | iEnd, | |||
UT_sint32 & | iFirst, | |||
UT_sint32 & | iLast, | |||
bool | bDontExpand = false | |||
) | const |
Find squiggles intersecting with region
iStart | Start offset of region | |
iEnd | End offset of region |
References _findFirstAfter(), _getCount(), FL_SQUIGGLE_GRAMMAR, getNth(), getSquiggleType(), s, UT_ASSERT, and xxx_UT_DEBUGMSG.
Referenced by textDeleted().
fl_PartOfBlockPtr fl_Squiggles::get | ( | UT_sint32 | iOffset | ) | const |
const fl_PartOfBlockPtr& fl_Squiggles::getNth | ( | UT_sint32 | n | ) | const [inline] |
Referenced by _deleteAtOffset(), _deleteNth(), _find(), _findFirstAfter(), _move(), add(), findRange(), get(), and recheckIgnoredWords().
FL_SQUIGGLE_TYPE fl_Squiggles::getSquiggleType | ( | void | ) | const [inline] |
Referenced by _deleteAtOffset(), add(), findRange(), join(), split(), textDeleted(), textInserted(), and textRevised().
void fl_Squiggles::join | ( | UT_sint32 | iOffset, | |
fl_BlockLayout * | pPrevBL | |||
) |
Join squiggles
iOffset | Offset to where squiggles are moved | |
pPrevBlock | Block they should be moved to |
This function is called when a paragrah break is deleted and two blocks are joined.
If either block is pending a background spell-check, the combined block is checked in full.
Any squiggle touching the IP is deleted and the word touching the IP becomes the pending word. The previously pending word, if any, becomes irrelevant.
References _deleteAtOffset(), _move(), fl_BlockLayout::_recalcPendingWord(), deleteAll(), FL_SQUIGGLE_SPELL, fl_BlockLayout::getDocLayout(), getSquiggleType(), fl_BlockLayout::isHdrFtr(), m_pOwner, UT_return_if_fail, and xxx_UT_DEBUGMSG.
void fl_Squiggles::markForRedraw | ( | const fl_PartOfBlockPtr & | pPOB | ) |
Mark all the runs overlapping with the POB for Redraw.
References fp_Run::getBlockOffset(), fl_BlockLayout::getFirstRun(), fp_Run::getLength(), fp_Run::getNextRun(), m_pOwner, and fp_Run::markAsDirty().
bool fl_Squiggles::recheckIgnoredWords | ( | const UT_UCSChar * | pBlockText | ) |
Recheck ignored words
pBlockText | The block's text |
References _deleteNth(), fl_BlockLayout::_doCheckWord(), _getCount(), getNth(), m_pOwner, and xxx_UT_DEBUGMSG.
void fl_Squiggles::split | ( | UT_sint32 | iOffset, | |
fl_BlockLayout * | pNewBL | |||
) |
Split squiggles
iOffset | Offset of split | |
pNewBL | New block |
Move squiggles after the offset to the new block. If there's a squiggle spanning the offset, delete it.
If the old block is pending a background spell-check, check both it and the new block.
Any pending word is forgotten (since we're splitting the word) and the word (if any) at the end of the line is checked, while the word at the start of the new line (if any) is made pending.
References _deleteAtOffset(), _move(), fl_BlockLayout::_recalcPendingWord(), deleteAll(), FL_SQUIGGLE_SPELL, fl_BlockLayout::getDocLayout(), getSquiggleType(), fl_BlockLayout::isHdrFtr(), m_pOwner, UT_return_if_fail, and xxx_UT_DEBUGMSG.
Text deleted - update squiggles
iOffset | Offset of deletion | |
iLength | Length of deletion |
References _deleteNth(), _move(), fl_BlockLayout::_recalcPendingWord(), findRange(), FL_SQUIGGLE_SPELL, fl_BlockLayout::getDocLayout(), getSquiggleType(), fl_BlockLayout::isHdrFtr(), m_pOwner, and xxx_UT_DEBUGMSG.
Text inserted - update squiggles
iOffset | Location at which insertion happens | |
iLength | Length of inserted text |
References _deleteAtOffset(), _move(), fl_BlockLayout::_recalcPendingWord(), FL_SQUIGGLE_SPELL, fl_BlockLayout::getDocLayout(), getSquiggleType(), fl_BlockLayout::isHdrFtr(), m_pOwner, and xxx_UT_DEBUGMSG.
change of fmt that impacts on spelling (e.g., delete in revisions mode, or undo of delete in revisions mode)
iOffset | Location at which insertion happens | |
iLength | Length of inserted text |
References _deleteAtOffset(), fl_BlockLayout::_recalcPendingWord(), FL_SQUIGGLE_SPELL, fl_BlockLayout::getDocLayout(), getSquiggleType(), fl_BlockLayout::isHdrFtr(), m_pOwner, and xxx_UT_DEBUGMSG.
Update the offsets in the POB's. We shifts the offsets around after text inside an emebdded section (like a footnote is changed).
iFirstOffset | this is the first offset that is changed. | |
iShift | this is the amount that the text is shifted. |
References m_vecSquiggles.
fl_BlockLayout* fl_Squiggles::m_pOwner [private] |
Referenced by _move(), clear(), join(), markForRedraw(), recheckIgnoredWords(), split(), textDeleted(), textInserted(), and textRevised().
std::vector<fl_PartOfBlockPtr> fl_Squiggles::m_vecSquiggles [private] |
Referenced by _deleteNth(), _move(), _purge(), add(), and updatePOBs().