Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Private Types | Private Member Functions | Private Attributes

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, UT_sint32 iLenSkip=0)
void appendTextToBuf (UT_GrowBuf &buf) const
virtual bool hasLayoutProperties (void) const
bool canMergeWithNext (void)
void mergeWithNext (void)
bool findFirstNonBlankSplitPoint (fp_RunSplitInfo &splitInfo)
bool isOneItem (fp_Run *pNext)
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 itemize (void)
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 ()
GR_ShapingInfo::TextTransform getTextTransform () const
void setTextTransform (GR_ShapingInfo::TextTransform transform)

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

GR_ShapingInfo::TextTransform m_TextTransform
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 (  )  [virtual]

Member Function Documentation

bool fp_TextRun::_canContainPoint ( void   )  const [protected, virtual]

Reimplemented from fp_Run.

References fp_Run::getField().

void fp_TextRun::_draw ( dg_DrawArgs pDA  )  [protected, virtual]

Implements fp_Run.

References _drawFirstChar(), _drawInvisibles(), _drawLastChar(), _fillRect(), fp_Run::_getColorHL(), fp_Run::_getDirection(), fp_Run::_getFont(), fp_Run::_getView(), _refreshDrawBuffer(), GR_Graphics::DGP_OPAQUEOVERLAY, GR_Graphics::DGP_SCREEN, fp_Run::drawDecors(), GR_Painter::drawLine(), fp_Run::Fill(), fl_BLOCK_STRUX_OFFSET, fp_Run::getAscent(), fp_Run::getBlock(), fp_Run::getBlockOffset(), FV_View::getColorFieldOffset(), FV_View::getColorSelBackground(), fl_ContainerLayout::getContainerType(), fp_Run::getDescent(), fl_BlockLayout::getDocLayout(), fp_Run::getFGColor(), fp_Run::getField(), GR_Graphics::getFontAscent(), GR_Graphics::getFontDescent(), GR_Graphics::getFontHeight(), fp_Run::getHeight(), fp_Run::getLength(), fp_Run::getLine(), fp_Run::getNextVisual(), FV_View::getPoint(), PD_StruxIterator::getPosition(), fl_BlockLayout::getPosition(), fp_Run::getPrevVisual(), fp_Line::getScreenRect(), FV_View::getSelectionAnchor(), FV_View::getSelectionMode(), FV_View::getShowPara(), fp_Run::getType(), GR_RenderInfo::getType(), FL_DocLayout::getView(), fp_Run::getVisDirection(), fp_Run::getWidth(), fp_Run::getY(), GR_Font::hashKey(), fl_CellLayout::isCellSelected(), fl_BlockLayout::isContainedByTOC(), fp_Run::isInSelectedTOC(), fp_Run::isSelectionDraw(), UT_Rect::left, m_bGrammarSquiggled, m_bIsOverhanging, m_bKeepWidths, m_bSpellSquiggled, m_fPosition, GR_RenderInfo::m_iLength, GR_RenderInfo::m_iOffset, GR_XPRenderInfo::m_iSegmentCount, fp_Run::m_iVisDirection, GR_RenderInfo::m_pFont, GR_RenderInfo::m_pGraphics, m_pRenderInfo, GR_XPRenderInfo::m_pSegmentOffset, GR_RenderInfo::m_pText, GR_RenderInfo::m_xoff, GR_RenderInfo::m_yoff, fl_ContainerLayout::myContainingLayout(), dg_DrawArgs::pG, GR_Graphics::prepareToRenderChars(), GR_Graphics::queryProperties(), GR_Painter::renderChars(), GR_Graphics::setColor(), GR_Graphics::setFont(), PD_StruxIterator::setPosition(), text, TEXT_POSITION_SUBSCRIPT, TEXT_POSITION_SUPERSCRIPT, GR_Graphics::tlu(), UT_ASSERT, UT_BIDI_LTR, UT_BIDI_RTL, UT_DEBUGMSG, UT_MAX, UT_MIN, UT_return_if_fail, UT_Rect::width, dg_DrawArgs::xoff, xxx_UT_DEBUGMSG, and dg_DrawArgs::yoff.

void fp_TextRun::_drawInvisibles ( UT_sint32  xoff,
UT_sint32  yoff 
) [protected]
void fp_TextRun::_lookupProperties ( const PP_AttrProp pSpanAP,
const PP_AttrProp pBlockAP,
const PP_AttrProp pSectionAP,
GR_Graphics pG 
) [private, virtual]

Implements fp_Run.

References fp_Run::_getDecorations(), fp_Run::_getFont(), fp_Run::_orDecorations(), fp_Run::_setAscent(), fp_Run::_setColorFG(), fp_Run::_setDecorations(), fp_Run::_setDescent(), fp_Run::_setField(), fp_Run::_setFont(), fp_Run::_setHeight(), fp_Run::_setLineWidth(), FL_DocLayout::bgcrGrammar, FL_DocLayout::bgcrSpelling, breakMeAtDirBoundaries(), breakNeighborsAtDirBoundaries(), GR_ShapingInfo::CAPITALIZE, fp_Run::clearScreen(), fd, FL_DocLayout::findFont(), gchar, PP_AttrProp::getAttribute(), fp_Run::getBlock(), fp_Run::getBlockOffset(), UT_Language::getCodeFromCode(), PP_PropertyTypeColor::getColor(), fl_BlockLayout::getDocLayout(), fl_Layout::getDocument(), fp_Run::getField(), GR_Graphics::getFontAscent(), GR_Graphics::getFontDescent(), GR_Graphics::getFontHeight(), fp_Run::getGraphics(), getLanguage(), PD_Document::getStyle(), getTextTransform(), fp_Run::isPrinting(), GR_ShapingInfo::LOWERCASE, m_bIsOverhanging, m_bKeepWidths, GR_RenderInfo::m_eShapingResult, m_fPosition, m_iDirOverride, m_pLanguage, m_pRenderInfo, fp_Run::markDrawBufferDirty(), fp_Run::markWidthDirty(), PP_evalProperty(), PP_evalPropertyType(), Property_type_color, PT_STYLE_ATTRIBUTE_NAME, setDirection(), GR_Graphics::setFont(), setTextTransform(), fp_Run::TEXT_DECOR_BOTTOMLINE, fp_Run::TEXT_DECOR_LINETHROUGH, fp_Run::TEXT_DECOR_OVERLINE, fp_Run::TEXT_DECOR_TOPLINE, fp_Run::TEXT_DECOR_UNDERLINE, GR_ShapingInfo::UPPERCASE, PD_Style::used(), UT_ASSERT, UT_BIDI_UNSET, UT_convertToLogicalUnits(), and xxx_UT_DEBUGMSG.

bool fp_TextRun::_recalcWidth ( void   )  [protected, virtual]

Recalculates the width of our run, updating the block's width cache as required.

Returns:
returns true if the width of this run changed

Reimplemented from fp_Run.

References _addupCharWidths(), fp_Run::_getRecalcWidth(), _refreshDrawBuffer(), and fp_Run::getWidth().

bool fp_TextRun::alwaysFits ( void   )  const [virtual]
void fp_TextRun::appendTextToBuf ( UT_GrowBuf buf  )  const
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_bidiGetCharType(), and UT_return_if_fail.

Referenced by _lookupProperties().

bool fp_TextRun::doesContainNonBlankData ( void   )  const [virtual]
bool fp_TextRun::findFirstNonBlankSplitPoint ( fp_RunSplitInfo splitInfo  )  [virtual]
UT_BidiCharType fp_TextRun::getDirection ( void   )  const [virtual]

Reimplemented from fp_Run.

References fp_Run::_getDirection(), and m_iDirOverride.

Referenced by breakNeighborsAtDirBoundaries().

UT_BidiCharType fp_TextRun::getDirOverride (  )  const [inline]
const GR_Item* fp_TextRun::getItem (  )  const [inline]
const gchar * fp_TextRun::getLanguage ( void   )  const
GR_ShapingInfo::TextTransform fp_TextRun::getTextTransform (  )  const [inline]
bool fp_TextRun::hasLayoutProperties ( void   )  const [virtual]

Reimplemented from fp_Run.

bool fp_TextRun::isFirstCharacter ( UT_UCSChar  Character  )  const

References getCharacter().

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

Reimplemented from fp_Run.

References m_fPosition, and TEXT_POSITION_SUBSCRIPT.

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

Reimplemented from fp_Run.

References m_fPosition, and TEXT_POSITION_SUPERSCRIPT.

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(), 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, UT_ASSERT, and UT_return_if_fail.

Referenced by fp_Line::justify().

void fp_TextRun::orShapingRequired ( GRShapingResult  eR  )  [inline]
void fp_TextRun::setItem ( GR_Item i  ) 
void fp_TextRun::setShapingRequired ( GRShapingResult  eR  )  [inline]
void fp_TextRun::setTextTransform ( GR_ShapingInfo::TextTransform  transform  )  [inline]

Referenced by _lookupProperties(), and split().

bool fp_TextRun::split ( UT_uint32  iSplitOffset,
UT_sint32  iLenSkip = 0 
)
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_FMTMARK, FPRUN_HYPERLINK, 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.


Member Data Documentation

Referenced by _draw(), and _drawFirstChar().

Referenced by _draw(), and _lookupProperties().

bool fp_TextRun::m_bKeepWidths [private]

Referenced by _draw(), and _lookupProperties().

Referenced by _draw(), and _drawFirstChar().

bool fp_TextRun::s_bBidiOS = false [static]

The documentation for this class was generated from the following files: