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

fp_Line Class Reference

#include <fp_Line.h>

Inheritance diagram for fp_Line:
fp_Container fp_ContainerObject

List of all members.

Public Member Functions

 fp_Line (fl_SectionLayout *pSectionLayout)
 ~fp_Line ()
fl_BlockLayoutgetBlock (void) const
virtual UT_sint32 getHeight (void) const
 Return height of line as it will appear on screen.
virtual UT_sint32 getX (void) const
virtual UT_sint32 getY (void) const
UT_sint32 getMaxWidth (void) const
UT_sint32 getAscent (void) const
UT_sint32 getDescent (void) const
UT_sint32 getNumRunsInLine (void) const
UT_sint32 getColumnGap (void) const
void setAssignedScreenHeight (UT_sint32)
bool assertLineListIntegrity (void)
void setMaxWidth (UT_sint32)
virtual void setX (UT_sint32 i, bool bDontClearIfNeeded=false)
virtual void setY (UT_sint32)
virtual void setContainer (fp_Container *)
void setBlock (fl_BlockLayout *pBlock)
fp_ContainergetColumn (void) const
fp_PagegetPage (void) const
virtual void setWidth (UT_sint32)
virtual void setHeight (UT_sint32 i)
virtual UT_sint32 getWidth (void) const
virtual UT_sint32 getDrawingWidth (void) const
UT_sint32 getWidthToRun (fp_Run *pLastRun)
UT_sint32 getFilledWidth (void) const
virtual bool isVBreakable (void)
virtual bool isHBreakable (void)
virtual UT_sint32 wantVBreakAt (UT_sint32)
virtual UT_sint32 wantHBreakAt (UT_sint32)
virtual fp_ContainerObjectVBreakAt (UT_sint32)
virtual fp_ContainerObjectHBreakAt (UT_sint32)
virtual UT_uint32 distanceFromPoint (UT_sint32, UT_sint32)
virtual fp_ContainergetNextContainerInSection (void) const
virtual fp_ContainergetPrevContainerInSection (void) const
fp_RungetRunFromIndex (UT_uint32 runIndex)
bool containsForcedColumnBreak (void) const
bool containsForcedPageBreak (void) const
bool containsFootnoteReference (void)
bool getFootnoteContainers (UT_GenericVector< fp_FootnoteContainer * > *pvecFoots)
bool containsAnnotations (void)
bool getAnnotationContainers (UT_GenericVector< fp_AnnotationContainer * > *pvecAnnotations)
void addRun (fp_Run *)
void insertRunAfter (fp_Run *pRun1, fp_Run *pRun2)
void insertRunBefore (fp_Run *pNewRun, fp_Run *pBefore)
void insertRun (fp_Run *)
bool removeRun (fp_Run *, bool bTellTheRunAboutIt=true)
bool isEmpty (void) const
int countRuns (void) const
fp_RungetFirstRun (void) const
fp_RungetLastRun (void) const
fp_RungetLastTextRun (void) const
fp_RuncalculateWidthOfRun (UT_sint32 &iX, UT_uint32 iIndxVisual, FL_WORKING_DIRECTION eWorkingDirection, FL_WHICH_TABSTOP eUseTabStop)
void getWorkingDirectionAndTabstops (FL_WORKING_DIRECTION &eWorkingDirection, FL_WHICH_TABSTOP &eUseTabStop) const
bool isFirstLineInBlock (void) const
bool isLastLineInBlock (void) const
virtual UT_Option< UT_RectgetScreenRect () const
virtual void markDirtyOverlappingRuns (const UT_Rect &recScreen)
void remove (void)
UT_sint32 getMarginBefore (void) const
UT_sint32 getMarginAfter (void) const
virtual void mapXYToPosition (UT_sint32 xPos, UT_sint32 yPos, PT_DocPosition &pos, bool &bBOL, bool &bEOL, bool &isTOC)
void getOffsets (const fp_Run *pRun, UT_sint32 &xoff, UT_sint32 &yoff) const
void getScreenOffsets (const fp_Run *pRun, UT_sint32 &xoff, UT_sint32 &yoff) const
virtual void clearScreen (void)
void clearScreenFromRunToEnd (UT_uint32 runIndex)
void clearScreenFromRunToEnd (fp_Run *pRun)
bool containsOffset (PT_DocPosition blockOffset)
void setScreenCleared (bool bisCleared)
bool isScreenCleared (void) const
void setAdditionalMargin (UT_sint32 iAccum)
virtual void draw (dg_DrawArgs *)
virtual void draw (GR_Graphics *)
void align (void)
void layout (void)
bool recalculateFields (UT_uint32 iUpdateCount)
void recalcHeight (fp_Run *pLast=NULL)
void recalcMaxWidth (bool bDontClearIfNeeded=false)
void setReformat (void)
void coalesceRuns (void)
UT_sint32 calculateWidthOfLine (void)
UT_sint32 calculateWidthOfTrailingSpaces (void)
void resetJustification (bool bPermanent)
void justify (UT_sint32 iAmount)
UT_uint32 countJustificationPoints (void)
bool isLastCharacter (UT_UCSChar Character) const
bool findNextTabStop (UT_sint32 iStartX, UT_sint32 &iPosition, eTabType &iType, eTabLeader &iLeader)
bool findPrevTabStop (UT_sint32 iStartX, UT_sint32 &iPosition, eTabType &iType, eTabLeader &iLeader)
void setNeedsRedraw (void)
bool needsRedraw (void)
bool redrawUpdate (void)
fp_RungetLastVisRun ()
fp_RungetFirstVisRun ()
UT_uint32 getVisIndx (fp_Run *pRun)
fp_RungetRunAtVisPos (UT_sint32 i)
void setMapOfRunsDirty ()
void addDirectionUsed (UT_BidiCharType dir, bool bRefreshMap=true)
void removeDirectionUsed (UT_BidiCharType dir, bool bRefreshMap=true)
void changeDirectionUsed (UT_BidiCharType oldDir, UT_BidiCharType newDir, bool bRefreshMap=true)
UT_sint32 getBreakTick (void) const
void setBreakTick (UT_sint32 iTick)
void setWrapped (bool bWrapped)
bool isWrapped (void) const
void setSameYAsPrevious (bool bSameAsPrevious)
bool isSameYAsPrevious (void) const
void setAlongTopBorder (bool bAlongTopBorder)
void setAlongBotBorder (bool bAlongBotBorder)
bool isAlongTopBorder (void) const
bool isAlongBotBorder (void) const
void genOverlapRects (UT_Rect &recLeft, UT_Rect &recRight)
bool canContainPoint () const
UT_sint32 calcLeftBorderThick (void)
UT_sint32 calcRightBorderThick (void)
UT_sint32 calcTopBorderThick (void)
UT_sint32 calcBotBorderThick (void)
void calcBorderThickness (void)
UT_sint32 getLeftThick (void) const
UT_sint32 getRightThick (void) const
UT_sint32 getTopThick (void) const
UT_sint32 getBotThick (void) const
UT_sint32 getAvailableWidth (void) const
const fp_LinegetFirstInContainer (void) const
const fp_LinegetLastInContainer (void) const
bool canDrawTopBorder (void) const
bool canDrawBotBorder (void) const
void drawBorders (GR_Graphics *pG)
UT_sint32 getLeftEdge (void) const
UT_sint32 getRightEdge (void) const
bool getAbsLeftRight (UT_sint32 &left, UT_sint32 &right)
bool hasBordersOrShading (void) const

Protected Member Functions

void _calculateWidthOfRun (UT_sint32 &iX, fp_Run *pRun, UT_uint32 iIndx, UT_uint32 iCountRuns, FL_WORKING_DIRECTION eWorkingDirection, FL_WHICH_TABSTOP eUseTabStop, UT_BidiCharType iDomDirection)

Private Member Functions

void _splitRunsAtSpaces (void)
void _doClearScreenFromRunToEnd (UT_sint32 runIndex)
void setAscent (UT_sint32 i)
void setDescent (UT_sint32 i)
void setScreenHeight (UT_sint32 i)
UT_uint32 _getRunVisIndx (UT_sint32 indx)
UT_uint32 _getRunLogIndx (UT_sint32 indx)
UT_sint32 _createMapOfRuns ()
void _updateContainsFootnoteRef (void)

Private Attributes

UT_sint32 m_iWidth
UT_sint32 m_iMaxWidth
UT_sint32 m_iClearToPos
UT_sint32 m_iClearLeftOffset
UT_sint32 m_iHeight
UT_sint32 m_iScreenHeight
 Height assigned on screen -1 if undefined.
UT_sint32 m_iAscent
UT_sint32 m_iDescent
UT_sint32 m_iX
UT_sint32 m_iY
UT_GenericVector< fp_Run * > m_vecRuns
bool m_bNeedsRedraw
bool m_bMapDirty
UT_uint32 m_iRunsRTLcount
UT_uint32 m_iRunsLTRcount
UT_sint32 m_iMaxDirLevel
bool m_bIsCleared
bool m_bContainsFootnoteRef
UT_sint32 m_iBreakTick
bool m_bIsWrapped
bool m_bIsSameYAsPrevious
bool m_bIsAlongTopBorder
bool m_bIsAlongBotBorder
UT_sint32 m_iAdditionalMarginAfter
UT_sint32 m_iLeftThick
UT_sint32 m_iRightThick
UT_sint32 m_iTopThick
UT_sint32 m_iBotThick

Static Private Attributes

static UT_sint32s_pOldXs = NULL
static UT_uint32 s_iOldXsSize = 0
static UT_uint32 s_iClassInstanceCounter = 0
static UT_Bytes_pEmbeddingLevels = 0
static UT_uint32s_pMapOfRunsL2V = 0
static UT_uint32s_pMapOfRunsV2L = 0
static UT_UCS4Chars_pPseudoString = 0
static UT_sint32 s_iMapOfRunsSize = 0
static fp_Lines_pMapOwner = 0


class fp_Run

Constructor & Destructor Documentation

Member Function Documentation

void fp_Line::_updateContainsFootnoteRef ( void   )  [private]

Scan through the runs on this line, checking for footnote anchor fields. Return true if so.

References fp_FieldRun::getFieldType(), UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), fp_Run::getType(), m_bContainsFootnoteRef, and m_vecRuns.

void fp_Line::addDirectionUsed ( UT_BidiCharType  dir,
bool  bRefreshMap = true 
void fp_Line::align ( void   ) 
bool fp_Line::assertLineListIntegrity ( void   ) 
bool fp_Line::canContainPoint (  )  const
void fp_Line::changeDirectionUsed ( UT_BidiCharType  oldDir,
UT_BidiCharType  newDir,
bool  bRefreshMap = true 
void fp_Line::clearScreenFromRunToEnd ( fp_Run ppRun  ) 
void fp_Line::clearScreenFromRunToEnd ( UT_uint32  runIndex  ) 

This method clears a line from the first non-dirty run at the given index to the end of the line.

UT_uint32 runIndex - visual run index
clearing to end in RTL paragraph means clearing from run end to the left edge

References _doClearScreenFromRunToEnd(), getBlock(), and xxx_UT_DEBUGMSG.

Referenced by fl_BlockLayout::_truncateLayout(), fp_Run::clearIfNeeded(), fb_Alignment_justify::eraseLineFromRun(), fb_Alignment_right::eraseLineFromRun(), fb_Alignment_left::eraseLineFromRun(), layout(), and removeRun().

void fp_Line::coalesceRuns ( void   ) 

Call to this function must be followed by calling fp_Line::layout() since coalescing runs might require shaping of the resulting run, which in turn might result in lost of justification information (this is due to the fact that the data used by the external shaping engine can be opaque to us, so we are not able to combine it for the two original runs -- we have to ask the external engine to recalculate it for the whole combined run).

At the moment we simply call coalesceRuns() just before doing layout() in fb_LineBreaker().

References fp_TextRun::canMergeWithNext(), UT_GenericVector< T >::getItemCount(), fp_Run::getNextRun(), UT_GenericVector< T >::getNthItem(), fp_Run::getType(), m_vecRuns, fp_TextRun::mergeWithNext(), removeRun(), fp_Run::setNextRun(), fp_Run::setPrevRun(), and xxx_UT_DEBUGMSG.

Referenced by fb_LineBreaker::breakParagraph(), and fl_BlockLayout::coalesceRuns().

bool fp_Line::containsFootnoteReference ( void   ) 
bool fp_Line::containsForcedColumnBreak ( void   )  const
bool fp_Line::containsForcedPageBreak ( void   )  const
bool fp_Line::containsOffset ( PT_DocPosition  blockOffset  ) 
virtual UT_uint32 fp_Line::distanceFromPoint ( UT_sint32  ,
) [inline, virtual]

Implements fp_Container.

bool fp_Line::findNextTabStop ( UT_sint32  iStartX,
UT_sint32 iPosition,
eTabType iType,
eTabLeader iLeader 
bool fp_Line::findPrevTabStop ( UT_sint32  iStartX,
UT_sint32 iPosition,
eTabType iType,
eTabLeader iLeader 
UT_sint32 fp_Line::getBotThick ( void   )  const

References m_iBotThick.

Referenced by getDescent().

UT_sint32 fp_Line::getBreakTick ( void   )  const [inline]

Reimplemented from fp_ContainerObject.

References fp_ContainerObject::m_iBreakTick.

UT_sint32 fp_Line::getColumnGap ( void   )  const

Return the gap between columns.

References getColumn().

UT_sint32 fp_Line::getDescent ( void   )  const
UT_sint32 fp_Line::getDrawingWidth ( void   )  const [virtual]
UT_sint32 fp_Line::getLeftEdge ( void   )  const

The left most esge of the paragraph relative to it's container.

References getBlock(), fl_BlockLayout::getLeftMargin(), and fl_BlockLayout::getTextIndent().

Referenced by draw(), drawBorders(), and getAbsLeftRight().

UT_sint32 fp_Line::getNumRunsInLine ( void   )  const [inline]
UT_sint32 fp_Line::getRightEdge ( void   )  const

The left most esge of the paragraph relative to it's container.

References getBlock(), fp_Container::getContainer(), getMaxWidth(), fl_BlockLayout::getRightMargin(), and fp_VerticalContainer::getWidth().

Referenced by draw(), drawBorders(), recalcMaxWidth(), and setMaxWidth().

UT_sint32 fp_Line::getRightThick ( void   )  const
fp_Run * fp_Line::getRunFromIndex ( UT_uint32  runIndex  ) 

Return a pointer to the run given by runIndex in the line

runIndex the nth run in the line
fp_Run * pRun the pointer to the nth run

References UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), and m_vecRuns.

Referenced by fp_FieldTOCNumRun::calculateValue(), containsAnnotations(), containsFootnoteReference(), getAnnotationContainers(), and getFootnoteContainers().

UT_sint32 fp_Line::getTopThick ( void   )  const

References m_iTopThick.

Referenced by getAscent().

virtual UT_sint32 fp_Line::getWidth ( void   )  const [inline, virtual]
bool fp_Line::hasBordersOrShading ( void   )  const

References getBlock().

Referenced by recalcHeight(), recalcMaxWidth(), and setMaxWidth().

virtual fp_ContainerObject* fp_Line::HBreakAt ( UT_sint32   )  [inline, virtual]

Implements fp_ContainerObject.

bool fp_Line::isAlongBotBorder ( void   )  const [inline]
bool fp_Line::isAlongTopBorder ( void   )  const [inline]

Referenced by getAscent(), and recalcHeight().

bool fp_Line::isFirstLineInBlock ( void   )  const [inline]

Returns true if this is the first line in the block.

References fl_ContainerLayout::getFirstContainer(), and m_pBlock.

Referenced by calcBorderThickness(), genOverlapRects(), getMarginBefore(), and recalcMaxWidth().

virtual bool fp_Line::isHBreakable ( void   )  [inline, virtual]

Implements fp_ContainerObject.

bool fp_Line::isLastCharacter ( UT_UCSChar  Character  )  const
bool fp_Line::isLastLineInBlock ( void   )  const

Returns true if this is the last line in the block.

References fl_ContainerLayout::getLastContainer(), and m_pBlock.

Referenced by calcBorderThickness(), getDrawingWidth(), getMarginAfter(), and fb_Alignment_justify::initialize().

bool fp_Line::isScreenCleared ( void   )  const [inline]

References fp_Run::m_bIsCleared.

Referenced by clearScreen().

virtual bool fp_Line::isVBreakable ( void   )  [inline, virtual]

Implements fp_ContainerObject.

void fp_Line::markDirtyOverlappingRuns ( const UT_Rect recScreen  )  [virtual]

Marks Dirty any runs that overlap the supplied rectangle. This rectangle is relative to the screen.

Implements fp_ContainerObject.

References getFirstRun(), getLastRun(), fp_Run::getNextRun(), getScreenRect(), UT_Rect::intersectsRect(), and fp_Run::markDirtyOverlappingRuns().

bool fp_Line::needsRedraw ( void   )  [inline]
void fp_Line::recalcHeight ( fp_Run pLastRun = NULL  ) 

Compute the height of the line

Note that while the line is asked to provide height/width and computes this based on its content Runs, it may later be assigned additional screen estate by having its height changed. That does not affect or override layout details, but increases precision of XY/position conversions.

I originally put in an assertion that checked that the line was only ever asked to grow in size. But that fired a lot, so it had to be removed. This suggests that we actually try to render stuff to closely on screen - the fp_Line::recalcHeight function should probably be fixed to round height and widths up always. But it gets its data from Runs, so this is not where the problem should be fixed.

See also:
fp_Column::layout, fp_Line::setAssignedScreenHeight

References clearScreen(), fl_BlockLayout::forceSectionBreak(), fp_Run::getAscent(), getAscent(), getBlock(), fp_Run::getDescent(), getDescent(), fp_Run::getHeight(), getHeight(), UT_GenericVector< T >::getItemCount(), fl_BlockLayout::getLineSpacing(), UT_GenericVector< T >::getNthItem(), getPage(), fp_Container::getPrev(), fp_Run::getType(), fp_Page::getWidth(), getWidth(), hasBordersOrShading(), isAlongBotBorder(), isAlongTopBorder(), isSameYAsPrevious(), fp_Run::isSubscript(), fp_Run::isSuperscript(), m_iAscent, m_iBotThick, m_iClearLeftOffset, m_iDescent, m_iMaxWidth, m_iScreenHeight, m_iTopThick, m_pBlock, m_vecRuns, setAscent(), setDescent(), setHeight(), setScreenHeight(), fl_BlockLayout::spacing_ATLEAST, fl_BlockLayout::spacing_EXACT, UT_ASSERT, UT_MAX, and xxx_UT_DEBUGMSG.

Referenced by fb_LineBreaker::_breakTheLineAtLastRunToKeep(), _doClearScreenFromRunToEnd(), calcBorderThickness(), fl_BlockLayout::doclistener_changeStrux(), fl_BlockLayout::formatWrappedFromHere(), layout(), setContainer(), and fl_BlockLayout::setLineHeightBlockWithBorders().

bool fp_Line::redrawUpdate ( void   ) 

returns true if the line is on screen, false otherwise the caller can use this to test whether further processing is necessary, for instance inside a loop if the return value changes from true to false then no more visible lines are forthcoming and the loop can be terminated

References draw(), fp_Run::getGraphics(), UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), fp_Container::isOnScreen(), m_bNeedsRedraw, and m_vecRuns.

Referenced by fl_BlockLayout::redrawUpdate().

void fp_Line::removeDirectionUsed ( UT_BidiCharType  dir,
bool  bRefreshMap = true 
void fp_Line::setAdditionalMargin ( UT_sint32  iAccum  )  [inline]
void fp_Line::setAlongBotBorder ( bool  bAlongBotBorder  )  [inline]
void fp_Line::setAlongTopBorder ( bool  bAlongTopBorder  )  [inline]
void fp_Line::setAscent ( UT_sint32  i  )  [inline, private]

References fp_Run::m_iAscent.

Referenced by recalcHeight().

void fp_Line::setAssignedScreenHeight ( UT_sint32  iHeight  )  [virtual]

Set height assigned to line on screen

iHeight Height in screen units

While recalcHeight computes the height of the line as it will render on the screen, the fp_Column does the actual line layout and does so with greater accuracy. In particular, the line may be assigned a different height on the screen than what it asked for.

This function allows the line representation to reflect the actual screen layout size, which improves the precision of XY/position conversion functions.

This function is quite intentionally not called setHeight. It should only be called from fp_Column::layout.
See also:
fp_Column::layout Note by Sevior: This method is causing pixel dirt by making lines smaller than their calculated heights!

Implements fp_Container.

References m_iScreenHeight.

Referenced by fp_Column::layout().

void fp_Line::setBreakTick ( UT_sint32  iTick  )  [inline]

Reimplemented from fp_ContainerObject.

References fp_ContainerObject::m_iBreakTick.

void fp_Line::setDescent ( UT_sint32  i  )  [inline, private]

References fp_Run::m_iDescent.

Referenced by recalcHeight().

void fp_Line::setHeight ( UT_sint32  i  )  [virtual]
void fp_Line::setMapOfRunsDirty (  )  [inline]
void fp_Line::setReformat ( void   ) 

Mark containing block for reformat from the first run of the line.

References getBlock(), fp_Run::getBlockOffset(), getFirstRun(), and fl_BlockLayout::setNeedsReformat().

Referenced by fp_VerticalContainer::bumpContainers(), setMaxWidth(), and setY().

void fp_Line::setScreenCleared ( bool  bisCleared  )  [inline]

References fp_Run::m_bIsCleared.

Referenced by clearScreen(), fp_Run::draw(), and ~fp_Line().

void fp_Line::setScreenHeight ( UT_sint32  i  )  [inline, private]

Referenced by recalcHeight().

virtual void fp_Line::setWidth ( UT_sint32   )  [inline, virtual]

Implements fp_ContainerObject.

void fp_Line::setWrapped ( bool  bWrapped  )  [inline]
void fp_Line::setX ( UT_sint32  i,
bool  bDontClearIfNeeded = false 
) [virtual]
void fp_Line::setY ( UT_sint32  iY  )  [virtual]
virtual fp_ContainerObject* fp_Line::VBreakAt ( UT_sint32   )  [inline, virtual]

Implements fp_ContainerObject.

virtual UT_sint32 fp_Line::wantHBreakAt ( UT_sint32   )  [inline, virtual]

Implements fp_ContainerObject.

virtual UT_sint32 fp_Line::wantVBreakAt ( UT_sint32   )  [inline, virtual]

Implements fp_ContainerObject.

Friends And Related Function Documentation

friend class fp_Run [friend]

Member Data Documentation

Referenced by calcBorderThickness().

Referenced by calcBorderThickness().

bool fp_Line::m_bIsCleared [private]

Referenced by setSameYAsPrevious().

bool fp_Line::m_bIsWrapped [private]
bool fp_Line::m_bNeedsRedraw [private]

Referenced by redrawUpdate(), and setNeedsRedraw().

Referenced by getAscent(), and recalcHeight().

Reimplemented from fp_ContainerObject.

Referenced by getHeight(), and setHeight().

Height assigned on screen -1 if undefined.

Referenced by clearScreen(), recalcHeight(), and setAssignedScreenHeight().

Referenced by getX(), and setX().

Referenced by getY(), and setY().

Reimplemented from fp_Container.

Referenced by fp_Line(), and ~fp_Line().

UT_sint32 fp_Line::s_iMapOfRunsSize = 0 [static, private]

Referenced by _createMapOfRuns(), and fp_Line().

UT_uint32 fp_Line::s_iOldXsSize = 0 [static, private]

Referenced by fp_Line(), layout(), and ~fp_Line().

UT_Byte * fp_Line::s_pEmbeddingLevels = 0 [static, private]

Referenced by _createMapOfRuns(), fp_Line(), and ~fp_Line().

fp_Line * fp_Line::s_pMapOwner = 0 [static, private]

Referenced by _createMapOfRuns(), and remove().

UT_sint32 * fp_Line::s_pOldXs = NULL [static, private]

Referenced by fp_Line(), layout(), and ~fp_Line().

UT_UCS4Char * fp_Line::s_pPseudoString = 0 [static, private]

Referenced by _createMapOfRuns(), fp_Line(), and ~fp_Line().

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