fp_TextRun Class Reference

#include <fp_TextRun.h>

Inheritance diagram for fp_TextRun:

fp_Run fp_ContainerObject

List of all members.

Public Types

enum  { Calculate_full_width = -1 }

Public Member Functions

 fp_TextRun (fl_BlockLayout *pBL, UT_uint32 iOffsetFirst, UT_uint32 iLen, bool bLookupProperties=true)
virtual ~fp_TextRun ()
virtual void mapXYToPosition (UT_sint32 xPos, UT_sint32 yPos, PT_DocPosition &pos, bool &bBOL, bool &bEOL, bool &isTOC)
virtual void findPointCoords (UT_uint32 iOffset, UT_sint32 &x, UT_sint32 &y, UT_sint32 &x2, UT_sint32 &y2, UT_sint32 &height, bool &bDirection)
virtual bool canBreakAfter (void) const
virtual bool canBreakBefore (void) const
virtual bool alwaysFits (void) const
virtual bool findMaxLeftFitSplitPoint (UT_sint32 iMaxLeftWidth, fp_RunSplitInfo &si, bool bForce=false)
virtual UT_sint32 findTrailingSpaceDistance (void) const
bool split (UT_uint32 iSplitOffset)
void appendTextToBuf (UT_GrowBuf &buf)
virtual bool hasLayoutProperties (void) const
bool canMergeWithNext (void)
void mergeWithNext (void)
bool findFirstNonBlankSplitPoint (fp_RunSplitInfo &splitInfo)
UT_sint32 simpleRecalcWidth (UT_sint32 iLength=Calculate_full_width)
void resetJustification (bool bPermanent)
void justify (UT_sint32 iAmount, UT_uint32 iSpacesInRun)
UT_sint32 countJustificationPoints (bool bLast) const
bool getCharacter (UT_uint32 run_offset, UT_UCSChar &Character) const
UT_sint32 findCharacter (UT_uint32 startPosition, UT_UCSChar Character) const
bool isFirstCharacter (UT_UCSChar Character) const
bool isLastCharacter (UT_UCSChar Character) const
virtual bool doesContainNonBlankData (void) const
virtual bool isSuperscript (void) const
virtual bool isSubscript (void) const
const GR_FontgetFont (void) const
const gchar * getLanguage () const
UT_sint32 getStr (UT_UCSChar *str, UT_uint32 &iMax)
void setDirection (UT_BidiCharType dir, UT_BidiCharType override)
void setDirOverride (UT_BidiCharType dir)
virtual UT_BidiCharType getDirection () const
UT_BidiCharType getDirOverride () const
void breakNeighborsAtDirBoundaries ()
void breakMeAtDirBoundaries (UT_BidiCharType iNewOverride)
void setShapingRequired (GRShapingResult eR)
void orShapingRequired (GRShapingResult eR)
void setItem (GR_Item *i)
const GR_ItemgetItem () const
virtual void updateOnDelete (UT_uint32 offset, UT_uint32 iLen)
virtual UT_uint32 adjustCaretPosition (UT_uint32 iDocumentPosition, bool bForward)
virtual void adjustDeletePosition (UT_uint32 &pos1, UT_uint32 &count)
void measureCharWidths ()

Public Attributes

UT_BidiCharType m_iDirOverride

Static Public Attributes

static UT_uint32 s_iClassInstanceCount = 0
static bool s_bBidiOS = false

Protected Member Functions

virtual bool _recalcWidth (void)
virtual bool _canContainPoint (void) const
virtual void _draw (dg_DrawArgs *)
virtual void _clearScreen (bool bFullLineHeightRect=true)
void _drawInvisibleSpaces (UT_sint32, UT_sint32)
void _drawInvisibles (UT_sint32, UT_sint32)
void _getPartRect (UT_Rect *pRect, UT_sint32 xoff, UT_sint32 yoff, UT_uint32 iStart, UT_uint32 iLen)
void _drawLastChar (bool bSelection)
void _drawFirstChar (bool bSelection)
void _fillRect (UT_RGBColor &clr, UT_sint32 xoff, UT_sint32 yoff, UT_uint32 iStart, UT_uint32 iLen, UT_Rect &rect, GR_Graphics *pG)

Private Types

enum  { TEXT_POSITION_NORMAL, TEXT_POSITION_SUPERSCRIPT, TEXT_POSITION_SUBSCRIPT }

Private Member Functions

bool _refreshDrawBuffer ()
bool _addupCharWidths (void)
virtual void _lookupProperties (const PP_AttrProp *pSpanAP, const PP_AttrProp *pBlockAP, const PP_AttrProp *pSectionAP, GR_Graphics *pG)

Private Attributes

UT_Byte m_fPosition
bool m_bSpellSquiggled
bool m_bGrammarSquiggled
const gchar * m_pLanguage
bool m_bIsOverhanging
bool m_bKeepWidths
const GR_Itemm_pItem
GR_RenderInfom_pRenderInfo


Member Enumeration Documentation

anonymous enum

Enumerator:
Calculate_full_width 

anonymous enum [private]

Enumerator:
TEXT_POSITION_NORMAL 
TEXT_POSITION_SUPERSCRIPT 
TEXT_POSITION_SUBSCRIPT 


Constructor & Destructor Documentation

fp_TextRun::fp_TextRun ( fl_BlockLayout pBL,
UT_uint32  iOffsetFirst,
UT_uint32  iLen,
bool  bLookupProperties = true 
)

fp_TextRun::~fp_TextRun (  )  [virtual]


Member Function Documentation

void fp_TextRun::mapXYToPosition ( UT_sint32  xPos,
UT_sint32  yPos,
PT_DocPosition pos,
bool &  bBOL,
bool &  bEOL,
bool &  isTOC 
) [virtual]

void fp_TextRun::findPointCoords ( UT_uint32  iOffset,
UT_sint32 x,
UT_sint32 y,
UT_sint32 x2,
UT_sint32 y2,
UT_sint32 height,
bool &  bDirection 
) [virtual]

bool fp_TextRun::canBreakAfter ( void   )  const [virtual]

bool fp_TextRun::canBreakBefore ( void   )  const [virtual]

bool fp_TextRun::alwaysFits ( void   )  const [virtual]

bool fp_TextRun::findMaxLeftFitSplitPoint ( UT_sint32  iMaxLeftWidth,
fp_RunSplitInfo si,
bool  bForce = false 
) [virtual]

UT_sint32 fp_TextRun::findTrailingSpaceDistance ( void   )  const [virtual]

bool fp_TextRun::split ( UT_uint32  iSplitOffset  ) 

References _addupCharWidths(), fp_Run::_getColorFG(), fp_Run::_getColorHL(), fp_Run::_getDecorations(), fp_Run::_getDirection(), fp_Run::_getFont(), fp_Run::_getLineWidth(), fp_Run::_getRefreshDrawBuffer(), fp_Run::_setAscent(), fp_Run::_setColorFG(), fp_Run::_setColorHL(), fp_Run::_setDecorations(), fp_Run::_setDescent(), fp_Run::_setDirection(), fp_Run::_setDirty(), fp_Run::_setField(), fp_Run::_setFont(), fp_Run::_setHeight(), fp_Run::_setHyperlink(), fp_Run::_setLineWidth(), fp_Run::_setRefreshDrawBuffer(), fp_Run::_setRevisions(), fp_Run::_setX(), fp_Run::_setY(), fp_TextRun(), fp_Run::getAscent(), fp_Run::getAuthorNum(), fp_Run::getBlock(), fp_Run::getBlockOffset(), fp_Run::getDescent(), fp_Run::getField(), getFont(), fp_Run::getGraphics(), fp_Run::getHeight(), fp_Run::getHyperlink(), fp_Run::getLength(), fp_Run::getLine(), fp_Run::getNextRun(), fp_Run::getRevisions(), fp_Run::getVisDirection(), fp_Run::getVisibility(), fp_Run::getWidth(), fp_Run::getX(), fp_Run::getY(), GRSR_Unknown, fp_Line::insertRunAfter(), m_fPosition, m_iDirOverride, GR_RenderInfo::m_iLength, GR_RenderInfo::m_iOffset, GR_RenderInfo::m_pFont, GR_RenderInfo::m_pGraphics, GR_RenderInfo::m_pItem, m_pItem, m_pLanguage, m_pRenderInfo, GR_Item::makeCopy(), fp_Run::markAsDirty(), fp_Run::recalcWidth(), s_bBidiOS, fp_Run::setAuthorNum(), fp_Run::setLength(), fp_Run::setNextRun(), fp_Run::setPrevRun(), fp_Run::setVisDirection(), fp_Run::setVisibility(), GR_RenderInfo::split(), UT_ASSERT, UT_ASSERT_HARMLESS, UT_BIDI_LTR, UT_BIDI_RTL, and xxx_UT_DEBUGMSG.

Referenced by fp_Line::_splitRunsAtSpaces(), breakMeAtDirBoundaries(), breakNeighborsAtDirBoundaries(), and fl_BlockLayout::doclistener_changeSpan().

void fp_TextRun::appendTextToBuf ( UT_GrowBuf buf  ) 

bool fp_TextRun::hasLayoutProperties ( void   )  const [virtual]

Reimplemented from fp_Run.

bool fp_TextRun::canMergeWithNext ( void   ) 

void fp_TextRun::mergeWithNext ( void   ) 

bool fp_TextRun::findFirstNonBlankSplitPoint ( fp_RunSplitInfo splitInfo  )  [virtual]

UT_sint32 fp_TextRun::simpleRecalcWidth ( UT_sint32  iLength = Calculate_full_width  ) 

void fp_TextRun::resetJustification ( bool  bPermanent  ) 

void fp_TextRun::justify ( UT_sint32  iAmount,
UT_uint32  iSpacesInRun 
)

This metod distributes an extra width needed to make the line justified betten the spaces in this run

Parameters:
UT_sint32 iAmount : the extra width to distribute
UT_uint32 iSpacesInRun : the number of spaces in this run

References fp_Run::_setWidth(), fl_BLOCK_STRUX_OFFSET, fp_Run::getBlock(), fp_Run::getBlockOffset(), fp_Run::getGraphics(), fp_Run::getLength(), PD_StruxIterator::getPosition(), fp_Run::getWidth(), GR_Graphics::justify(), GR_RenderInfo::m_iJustificationAmount, GR_RenderInfo::m_iJustificationPoints, GR_RenderInfo::m_iLength, m_pRenderInfo, GR_RenderInfo::m_pText, PD_StruxIterator::setUpperLimit(), text, and UT_return_if_fail.

Referenced by fp_Line::justify().

UT_sint32 fp_TextRun::countJustificationPoints ( bool  bLast  )  const

bool fp_TextRun::getCharacter ( UT_uint32  run_offset,
UT_UCSChar Character 
) const

UT_sint32 fp_TextRun::findCharacter ( UT_uint32  startPosition,
UT_UCSChar  Character 
) const

bool fp_TextRun::isFirstCharacter ( UT_UCSChar  Character  )  const

References getCharacter().

bool fp_TextRun::isLastCharacter ( UT_UCSChar  Character  )  const

bool fp_TextRun::doesContainNonBlankData ( void   )  const [virtual]

bool fp_TextRun::isSuperscript ( void   )  const [inline, virtual]

Reimplemented from fp_Run.

References m_fPosition, and TEXT_POSITION_SUPERSCRIPT.

bool fp_TextRun::isSubscript ( void   )  const [inline, virtual]

Reimplemented from fp_Run.

References m_fPosition, and TEXT_POSITION_SUBSCRIPT.

const GR_Font* fp_TextRun::getFont ( void   )  const [inline]

const gchar * fp_TextRun::getLanguage ( void   )  const

UT_sint32 fp_TextRun::getStr ( UT_UCSChar str,
UT_uint32 iMax 
)

void fp_TextRun::setDirection ( UT_BidiCharType  dir,
UT_BidiCharType  override 
)

void fp_TextRun::setDirOverride ( UT_BidiCharType  dir  ) 

virtual UT_BidiCharType fp_TextRun::getDirection ( void   )  const [inline, virtual]

Reimplemented from fp_Run.

References fp_Run::_getDirection(), and UT_BIDI_UNSET.

Referenced by breakNeighborsAtDirBoundaries().

UT_BidiCharType fp_TextRun::getDirOverride (  )  const [inline]

void fp_TextRun::breakNeighborsAtDirBoundaries (  ) 

A word of explanaiton of the break*AtDirBoundaries() functions. In order to reduce our memory use, we merge runs that resolve to the same embeding level. For example, if we have the sequence 'RTL white_space RTL', we will merge it into one run that gets treated as RTL. However, if we insert a new character into this combined run, or on its left or right, this might result in the embeding level of the white_space segment changing. In order to handle this, we have to break the present run into segments that contain characters of the same type, do the bidi processing, and then we can again merge anything that is on the same embeding level. The two functions below are responsible for the breaking, and are invoked from inside the fl_BlockLayout class.

References fl_BLOCK_STRUX_OFFSET, FPRUN_TEXT, fp_Run::getBlock(), fp_Run::getBlockOffset(), getDirection(), getDirOverride(), fp_Run::getLength(), fp_Run::getNextRun(), fp_Run::getPrevRun(), PD_StruxIterator::getStatus(), fp_Run::getType(), fp_Run::getVisDirection(), setDirection(), split(), text, UT_ASSERT, UT_BIDI_IS_STRONG, UT_BIDI_UNSET, UT_bidiGetCharType(), UT_return_if_fail, and UTIter_OK.

Referenced by _lookupProperties().

void fp_TextRun::breakMeAtDirBoundaries ( UT_BidiCharType  iNewOverride  ) 

void fp_TextRun::setShapingRequired ( GRShapingResult  eR  )  [inline]

void fp_TextRun::orShapingRequired ( GRShapingResult  eR  )  [inline]

void fp_TextRun::setItem ( GR_Item i  )  [inline]

const GR_Item* fp_TextRun::getItem (  )  const [inline]

void fp_TextRun::updateOnDelete ( UT_uint32  offset,
UT_uint32  iLenToDelete 
) [virtual]

The following function allows us to respond to deletion of part of the text represented by this run in a smart way (smart here means avoiding recalculating the draw buffer when we do not have to)

Parameters:
offset,: run offset at which deletion starts
iLen,: length of the deleted section, can reach past the end of the run

Reimplemented from fp_Run.

References fp_Run::_getRefreshDrawBuffer(), GR_RenderInfo::cut(), fl_BLOCK_STRUX_OFFSET, FPRUN_BOOKMARK, FPRUN_FMTMARK, FPRUN_HYPERLINK, FPRUN_TEXT, fp_Run::getBlock(), fp_Run::getBlockOffset(), fp_Run::getLength(), fp_Run::getNextRun(), fp_Run::getPrevRun(), fp_Run::getType(), fp_Run::getVisDirection(), GRSR_ContextSensitive, GRSR_Unknown, GR_RenderInfo::m_eShapingResult, GR_RenderInfo::m_eState, GR_RenderInfo::m_iLength, GR_RenderInfo::m_iVisDir, m_pRenderInfo, GR_RenderInfo::m_pText, fp_Run::markWidthDirty(), fp_Run::orDrawBufferDirty(), fp_Run::setLength(), text, UT_MIN, UT_return_if_fail, and xxx_UT_DEBUGMSG.

UT_uint32 fp_TextRun::adjustCaretPosition ( UT_uint32  iDocumentPosition,
bool  bForward 
) [virtual]

void fp_TextRun::adjustDeletePosition ( UT_uint32 pos1,
UT_uint32 count 
) [virtual]

void fp_TextRun::measureCharWidths (  ) 

bool fp_TextRun::_refreshDrawBuffer (  )  [private]

bool fp_TextRun::_addupCharWidths ( void   )  [private]

void fp_TextRun::_lookupProperties ( const PP_AttrProp pSpanAP,
const PP_AttrProp pBlockAP,
const PP_AttrProp pSectionAP,
GR_Graphics pG 
) [private, virtual]