Dillo
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Types | Static Private Attributes | Friends | List of all members
dw::Textblock Class Reference

A Widget for rendering text blocks, i.e. paragraphs or sequences of paragraphs. More...

#include <textblock.hh>

Classes

struct  Anchor
 
class  BadnessAndPenalty
 
struct  DivChar
 
struct  Line
 
struct  Paragraph
 
class  SpaceImgRenderer
 
class  TextblockIterator
 
struct  Word
 
class  WordImgRenderer
 Implementation used for words. More...
 

Public Member Functions

 Textblock (bool limitTextWidth)
 
 ~Textblock ()
 
core::Iteratoriterator (core::Content::Type mask, bool atEnd)
 Return an iterator for this widget. More...
 
void flush ()
 
void addText (const char *text, size_t len, core::style::Style *style)
 
void addText (const char *text, core::style::Style *style)
 
void addWidget (core::Widget *widget, core::style::Style *style)
 
bool addAnchor (const char *name, core::style::Style *style)
 
void addSpace (core::style::Style *style)
 
void addBreakOption (core::style::Style *style, bool forceBreak)
 
void addParbreak (int space, core::style::Style *style)
 
void addLinebreak (core::style::Style *style)
 
void handOverBreak (core::style::Style *style)
 
void changeLinkColor (int link, int newColor)
 
void changeWordStyle (int from, int to, core::style::Style *style, bool includeFirstSpace, bool includeLastSpace)
 
void updateReference (int ref)
 
void widgetRefSizeChanged (int externalIndex)
 
void clearPositionChanged ()
 
void oofSizeChanged (bool extremesChanged)
 
int getGeneratorX (int oofmIndex)
 
int getGeneratorY (int oofmIndex)
 
int getGeneratorWidth (int callerX, int callerWidth)
 
int getMaxGeneratorWidth ()
 
bool usesMaxGeneratorWidth ()
 
bool isPossibleOOFContainer (int oofmIndex)
 
bool isPossibleOOFContainerParent (int oofmIndex)
 
- Public Member Functions inherited from dw::RegardingBorder
 RegardingBorder ()
 
 ~RegardingBorder ()
 
- Public Member Functions inherited from dw::oof::OOFAwareWidget
 OOFAwareWidget ()
 
 ~OOFAwareWidget ()
 
core::RequisitiongetRequisitionWithoutOOF ()
 
bool doesWidgetOOFInterruptDrawing (Widget *widget)
 
void draw (core::View *view, core::Rectangle *area, core::DrawingContext *context)
 
- Public Member Functions inherited from dw::core::Widget
void setDeleteCallback (DW_Callback_t func, void *data)
 
 Widget ()
 
 ~Widget ()
 
bool resizeQueued ()
 
bool extremesQueued ()
 
bool needsResize ()
 
bool needsAllocate ()
 
bool allocateQueued ()
 
bool extremesChanged ()
 
bool wasAllocated ()
 
void setParent (Widget *parent)
 
void setQuasiParent (Widget *quasiParent)
 
void setGenerator (Widget *generator)
 
style::StylegetStyle ()
 
AllocationgetAllocation ()
 
bool inAllocation (int x, int y)
 
int boxOffsetX ()
 
int boxRestWidth ()
 
int boxDiffWidth ()
 
int boxOffsetY ()
 
int boxRestHeight ()
 
int boxDiffHeight ()
 
void sizeRequest (Requisition *requisition, int numPos=0, Widget **references=NULL, int *x=NULL, int *y=NULL)
 This method is a wrapper for Widget::sizeRequestImpl(); it calls the latter only when needed. More...
 
void getExtremes (Extremes *extremes, int numPos=0, Widget **references=NULL, int *x=NULL, int *y=NULL)
 Wrapper for Widget::getExtremesImpl(). More...
 
void sizeAllocate (Allocation *allocation)
 Wrapper for Widget::sizeAllocateImpl, calls the latter only when needed. More...
 
void calcExtraSpace (int numPos, Widget **references, int *x, int *y)
 Calculates dw::core::Widget::extraSpace. More...
 
int getAvailWidth (bool forceValue)
 
int getAvailHeight (bool forceValue)
 
virtual bool getAdjustMinWidth ()
 
void correctRequisition (Requisition *requisition, void(*splitHeightFun)(int, int *, int *), bool allowDecreaseWidth, bool allowDecreaseHeight)
 
void correctExtremes (Extremes *extremes, bool useAdjustmentWidth)
 
int calcWidth (style::Length cssValue, int refWidth, Widget *refWidget, int limitMinWidth, bool forceValue)
 
void calcFinalWidth (style::Style *style, int refWidth, Widget *refWidget, int limitMinWidth, bool forceValue, int *finalWidth)
 
int calcHeight (style::Length cssValue, bool usePercentage, int refHeight, Widget *refWidget, bool forceValue)
 
virtual int applyPerWidth (int containerWidth, style::Length perWidth)
 
virtual int applyPerHeight (int containerHeight, style::Length perHeight)
 
int getMinWidth (Extremes *extremes, bool forceValue)
 Used to evaluate Widget::adjustMinWidth. More...
 
virtual bool isPossibleContainer ()
 
void containerSizeChanged ()
 
bool intersects (Widget *refWidget, Rectangle *area, Rectangle *intersection)
 Calculates the intersection of the visible allocation (i. e. the intersection with the visible parent allocation) and "area" (in widget coordinates referring to "refWidget"), returned in intersection (in widget coordinates). More...
 
void drawInterruption (View *view, Rectangle *area, DrawingContext *context)
 
WidgetgetWidgetAtPointInterrupted (int x, int y, GettingWidgetAtPointContext *context)
 
bool buttonPress (EventButton *event)
 
bool buttonRelease (EventButton *event)
 
bool motionNotify (EventMotion *event)
 
void enterNotify (EventCrossing *event)
 
void leaveNotify (EventCrossing *event)
 
virtual void setStyle (style::Style *style)
 Change the style of a widget. More...
 
void setBgColor (style::Color *bgColor)
 Set the background "behind" the widget, if it is not the background of the parent widget, e.g. the background of a table row. More...
 
style::ColorgetBgColor ()
 Get the actual background of a widget. More...
 
void drawBox (View *view, style::Style *style, Rectangle *area, int x, int y, int width, int height, bool inverse)
 Draw borders and background of a widget part, which allocation is given by (x, y, width, height) (widget coordinates). More...
 
void drawWidgetBox (View *view, Rectangle *area, bool inverse)
 Draw borders and background of a widget. More...
 
void drawSelected (View *view, Rectangle *area)
 
void setButtonSensitive (bool buttonSensitive)
 
bool isButtonSensitive ()
 
WidgetgetParent ()
 
WidgetgetContainer ()
 
WidgetgetTopLevel ()
 Get the widget at the root of the tree, this widget is part from. More...
 
int getLevel ()
 Get the level of the widget within the tree. More...
 
int getGeneratorLevel ()
 Get the level of the widget within the tree, regarting the generators, not the parents. More...
 
WidgetgetNearestCommonAncestor (Widget *otherWidget)
 Get the widget with the highest level, which is a direct ancestor of widget1 and widget2. More...
 
WidgetReferencegetWidgetReference ()
 
void setWidgetReference (WidgetReference *widgetReference)
 
WidgetgetGenerator ()
 
LayoutgetLayout ()
 
void scrollTo (HPosition hpos, VPosition vpos, int x, int y, int width, int height)
 
void getMarginArea (int *xMar, int *yMar, int *widthMar, int *heightMar)
 
void getBorderArea (int *xBor, int *yBor, int *widthBor, int *heightBor)
 
void getPaddingArea (int *xPad, int *yPad, int *widthPad, int *heightPad)
 Return the padding area (content plus padding). More...
 
virtual void removeChild (Widget *child)
 
- Public Member Functions inherited from lout::identity::IdentifiableObject
 IdentifiableObject ()
 
void intoStringBuffer (misc::StringBuffer *sb)
 Store a textual representation of the object in a misc::StringBuffer. More...
 
int getClassId ()
 Returns the class identifier. More...
 
const char * getClassName ()
 Return the name, under which the class of this object was registered. More...
 
bool instanceOf (int otherClassId)
 Returns, whether this class is an instance of the class, given by otherClassId, or of a sub class of this class. More...
 
- Public Member Functions inherited from lout::object::Object
virtual ~Object ()
 The destructor is defined as virtual (but not abstract), so that destruction of Object's works properly. More...
 
virtual bool equals (Object *other)
 Returns, whether two objects are equal. More...
 
virtual int hashValue ()
 Return a hash value for the object. More...
 
virtual Objectclone ()
 Return an exact copy of the object. More...
 
const char * toString ()
 Use object::Object::intoStringBuffer to return a textual representation of the object. More...
 
virtual size_t sizeOf ()
 Return the number of bytes, this object totally uses. More...
 

Static Public Member Functions

static void setPenaltyHyphen (int penaltyHyphen)
 
static void setPenaltyHyphen2 (int penaltyHyphen2)
 
static void setPenaltyEmDashLeft (int penaltyLeftEmDash)
 
static void setPenaltyEmDashRight (int penaltyRightEmDash)
 
static void setPenaltyEmDashRight2 (int penaltyRightEmDash2)
 
static void setStretchabilityFactor (int stretchabilityFactor)
 
static bool mustAddBreaks (core::style::Style *style)
 
- Static Public Member Functions inherited from dw::oof::OOFAwareWidget
static const char * stackingLevelText (int level)
 
static bool testStyleFloat (core::style::Style *style)
 
static bool testStyleAbsolutelyPositioned (core::style::Style *style)
 
static bool testStyleFixedlyPositioned (core::style::Style *style)
 
static bool testStyleRelativelyPositioned (core::style::Style *style)
 
static bool testStylePositioned (core::style::Style *style)
 
static bool testStyleOutOfFlow (core::style::Style *style)
 
static bool testWidgetFloat (Widget *widget)
 
static bool testWidgetAbsolutelyPositioned (Widget *widget)
 
static bool testWidgetFixedlyPositioned (Widget *widget)
 
static bool testWidgetRelativelyPositioned (Widget *widget)
 
static bool testWidgetPositioned (Widget *widget)
 
static bool testWidgetOutOfFlow (Widget *widget)
 
- Static Public Member Functions inherited from dw::core::Widget
static void setAdjustMinWidth (bool adjustMinWidth)
 
static void adjustHeight (int *height, bool allowDecreaseHeight, int ascent, int descent)
 

Static Public Attributes

static int CLASS_ID = -1
 
- Static Public Attributes inherited from dw::RegardingBorder
static int CLASS_ID = -1
 
- Static Public Attributes inherited from dw::oof::OOFAwareWidget
static int CLASS_ID = -1
 
- Static Public Attributes inherited from dw::core::Widget
static int CLASS_ID = -1
 

Protected Member Functions

void queueDrawRange (int index1, int index2)
 
int calcVerticalBorder (int widgetPadding, int widgetBorder, int widgetMargin, int lineBorderTotal, int lineMarginTotal)
 
void getWordExtremes (Word *word, core::Extremes *extremes)
 
void justifyLine (Line *line, int diff)
 
LineaddLine (int firstWord, int lastWord, int newLastOofPos, bool temporary, int minHeight)
 
void rewrap ()
 
void fillParagraphs ()
 
void initNewLine ()
 
void calcBorders (int lastOofRef, int height)
 
void showMissingLines ()
 
void removeTemporaryLines ()
 
void decorateText (core::View *view, core::style::Style *style, core::style::Color::Shading shading, int x, int yBase, int width)
 
void drawText (core::View *view, core::style::Style *style, core::style::Color::Shading shading, int x, int y, const char *text, int start, int len, bool isStart, bool isEnd)
 
void drawWord (Line *line, int wordIndex1, int wordIndex2, core::View *view, core::Rectangle *area, int xWidget, int yWidgetBase)
 
void drawWord0 (int wordIndex1, int wordIndex2, const char *text, int totalWidth, bool drawHyphen, core::style::Style *style, core::View *view, core::Rectangle *area, int xWidget, int yWidgetBase)
 
void drawSpace (int wordIndex, core::View *view, core::Rectangle *area, int xWidget, int yWidgetBase)
 
void drawLine (Line *line, core::View *view, core::Rectangle *area, core::DrawingContext *context)
 
int findLineIndex (int y)
 
int findLineIndexWhenNotAllocated (int y)
 
int findLineIndexWhenAllocated (int y)
 
int findLineIndex (int y, int ascent)
 
int findLineOfWord (int wordIndex)
 Find the line of word wordIndex. More...
 
int findParagraphOfWord (int wordIndex)
 Find the paragraph of word wordIndex. More...
 
WordfindWord (int x, int y, bool *inSpace)
 Find the index of the word, or -1. More...
 
WordaddWord (int width, int ascent, int descent, short flags, core::style::Style *style)
 
void breakAdded ()
 
void initWord (int wordNo)
 
void cleanupWord (int wordNo)
 
void removeWordImgRenderer (int wordNo)
 
void setWordImgRenderer (int wordNo)
 
void removeSpaceImgRenderer (int wordNo)
 
void setSpaceImgRenderer (int wordNo)
 
void fillWord (int wordNo, int width, int ascent, int descent, short flags, core::style::Style *style)
 
void fillSpace (int wordNo, core::style::Style *style)
 
void setBreakOption (Word *word, core::style::Style *style, int breakPenalty1, int breakPenalty2, bool forceBreak)
 
bool isBreakAllowedInWord (Word *word)
 
bool isBreakAllowed (core::style::Style *style)
 
int textWidth (const char *text, int start, int len, core::style::Style *style, bool isStart, bool isEnd)
 
void calcTextSize (const char *text, size_t len, core::style::Style *style, core::Requisition *size, bool isStart, bool isEnd)
 
bool calcSizeOfWidgetInFlow (int wordIndex, Widget *widget, core::Requisition *size)
 
bool findSizeRequestReference (Widget *reference, int *xRef=NULL, int *yRef=NULL)
 
bool findSizeRequestReference (int oofmIndex, int *xRef=NULL, int *yRef=NULL)
 
bool mustBorderBeRegarded (Line *line)
 
bool mustBorderBeRegarded (int lineNo)
 
int lineYOffsetWidget (Line *line, core::Allocation *allocation)
 
int lineYOffsetWidget (Line *line)
 
int lineYOffsetCanvas (Line *line, core::Allocation *allocation)
 
int lineYOffsetCanvas (Line *line)
 
int lineYOffsetWidget (int lineIndex)
 
int lineYOffsetWidget (int lineIndex, core::Allocation *allocation)
 
int lineYOffsetCanvas (int lineIndex)
 
int calcPenaltyIndexForNewLine ()
 
RegardingBordergetWidgetRegardingBorderForLine (Line *line)
 
RegardingBordergetWidgetRegardingBorderForLine (int lineNo)
 
RegardingBordergetWidgetRegardingBorderForLine (int firstWord, int lastWord)
 
int yOffsetOfLineToBeCreated (int *lastMargin=NULL)
 
int yOffsetOfLineCreated (Line *line)
 
bool sendSelectionEvent (core::SelectionState::EventType eventType, core::MousePositionEvent *event)
 Send event to selection. More...
 
void processWord (int wordIndex)
 
virtual int wordWrap (int wordIndex, bool wrapAll)
 
int wrapWordInFlow (int wordIndex, bool wrapAll)
 
int wrapWordOofRef (int wordIndex, bool wrapAll)
 
void balanceBreakPosAndHeight (int wordIndex, int firstIndex, int *searchUntil, bool tempNewLine, int penaltyIndex, bool borderIsCalculated, bool *thereWillBeMoreSpace, bool wrapAll, int *diffWords, int *wordIndexEnd, int *lastFloatPos, bool regardBorder, int *height, int *breakPos)
 
int searchBreakPos (int wordIndex, int firstIndex, int *searchUntil, bool tempNewLine, int penaltyIndex, bool thereWillBeMoreSpace, bool wrapAll, int *diffWords, int *wordIndexEnd, int *addIndex1=NULL)
 
int searchMinBap (int firstWord, int lastWordm, int penaltyIndex, bool thereWillBeMoreSpace, bool correctAtEnd)
 
int considerHyphenation (int firstIndex, int breakPos)
 
bool isHyphenationCandidate (Word *word)
 
int calcLinePartHeight (int firstWord, int lastWord)
 
void handleWordExtremes (int wordIndex)
 
void correctLastWordExtremes ()
 
int getLineShrinkability (int lastWordIndex)
 
int getLineStretchability (int lastWordIndex)
 
int hyphenateWord (int wordIndex, int *addIndex1=NULL)
 
void moveWordIndices (int wordIndex, int num, int *addIndex1=NULL)
 
void accumulateWordForLine (int lineIndex, int wordIndex)
 
void accumulateWordData (int wordIndex)
 
int calcLineBreakWidth (int lineIndex)
 
void initLine1Offset (int wordIndex)
 
void alignLine (int lineIndex)
 
void calcTextOffset (int lineIndex, int totalWidth)
 
void drawLevel (core::View *view, core::Rectangle *area, int level, core::DrawingContext *context)
 
WidgetgetWidgetAtPointLevel (int x, int y, int level, core::GettingWidgetAtPointContext *context)
 
void sizeRequestImpl (core::Requisition *requisition, int numPos, Widget **references, int *x, int *y)
 
int numSizeRequestReferences ()
 See Sizes of Dillo Widgets (or Size requisitions depending on positions). More...
 
WidgetsizeRequestReference (int index)
 See Sizes of Dillo Widgets (or Size requisitions depending on positions). More...
 
void getExtremesSimpl (core::Extremes *extremes)
 Simple variant, to be implemented by widgets with extremes not depending on positions. More...
 
int numGetExtremesReferences ()
 See Sizes of Dillo Widgets (or Size requisitions depending on positions). More...
 
WidgetgetExtremesReference (int index)
 See Sizes of Dillo Widgets (or Size requisitions depending on positions). More...
 
void notifySetAsTopLevel ()
 This method is called after a widget has been set as the top of a widget tree. More...
 
void notifySetParent ()
 This method is called after a widget has been added to a parent. More...
 
void sizeAllocateImpl (core::Allocation *allocation)
 See Sizes of Dillo Widgets. More...
 
void calcExtraSpaceImpl (int numPos, Widget **references, int *x, int *y)
 
int getAvailWidthOfChild (core::Widget *child, bool forceValue)
 
int getAvailHeightOfChild (core::Widget *child, bool forceValue)
 
void containerSizeChangedForChildren ()
 
bool affectsSizeChangeContainerChild (Widget *child)
 
bool usesAvailWidth ()
 Must be implemengted by a method returning true, when getAvailWidth() is called. More...
 
void resizeDrawImpl ()
 Called after sizeAllocateImpl() to redraw necessary areas. By default the whole widget is redrawn. More...
 
void markSizeChange (int ref)
 See Sizes of Dillo Widgets. More...
 
void markExtremesChange (int ref)
 See Sizes of Dillo Widgets. More...
 
bool isBlockLevel ()
 
bool buttonPressImpl (core::EventButton *event)
 
bool buttonReleaseImpl (core::EventButton *event)
 
bool motionNotifyImpl (core::EventMotion *event)
 
void enterNotifyImpl (core::EventCrossing *event)
 
void leaveNotifyImpl (core::EventCrossing *event)
 
void removeChild (Widget *child)
 
void addText0 (const char *text, size_t len, short flags, core::style::Style *style, core::Requisition *size)
 
void calcTextSizes (const char *text, size_t textLen, core::style::Style *style, int numBreaks, int *breakPos, core::Requisition *wordSize)
 
int getGeneratorRest (int oofmIndex)
 
- Protected Member Functions inherited from dw::oof::OOFAwareWidget
bool isParentRefOOF (int parentRef)
 
int makeParentRefInFlow (int inFlowSubRef)
 
int getParentRefInFlowSubRef (int parentRef)
 
int makeParentRefOOF (int oofmIndex, int oofmSubRef)
 
int getParentRefOOFSubRef (int parentRef)
 
int getParentRefOOFIndex (int parentRef)
 
oof::OutOfFlowMgrgetParentRefOutOfFlowMgr (int parentRef)
 
bool isWidgetOOF (Widget *widget)
 
int getWidgetInFlowSubRef (Widget *widget)
 
int getWidgetOOFSubRef (Widget *widget)
 
int getWidgetOOFIndex (Widget *widget)
 
oof::OutOfFlowMgrgetWidgetOutOfFlowMgr (Widget *widget)
 
OutOfFlowMgrsearchOutOfFlowMgr (int oofmIndex)
 
void initOutOfFlowMgrs ()
 
void correctRequisitionByOOF (core::Requisition *requisition, void(*splitHeightFun)(int, int *, int *))
 
void correctExtremesByOOF (core::Extremes *extremes)
 
void sizeAllocateStart (core::Allocation *allocation)
 
void sizeAllocateEnd ()
 
void containerSizeChangedForChildrenOOF ()
 
void drawOOF (core::View *view, core::Rectangle *area, core::DrawingContext *context)
 
WidgetgetWidgetAtPoint (int x, int y, core::GettingWidgetAtPointContext *context)
 
WidgetgetWidgetOOFAtPoint (int x, int y, core::GettingWidgetAtPointContext *context)
 
void removeChild (Widget *child)
 
virtual bool adjustExtraSpaceWhenCorrectingRequisitionByOOF ()
 
- Protected Member Functions inherited from dw::core::Widget
int getHeight ()
 
int getContentWidth ()
 
int getContentHeight ()
 
StackingContextMgrgetNextStackingContextMgr ()
 
void printFlag (Flags f)
 
void setFlags (Flags f)
 
void unsetFlags (Flags f)
 
void queueDraw ()
 
void queueDrawArea (int x, int y, int width, int height)
 
void queueResize (int ref, bool extremesChanged)
 
virtual void sizeRequestImpl (Requisition *requisition, int numPos, Widget **references, int *x, int *y)
 See Sizes of Dillo Widgets. More...
 
virtual void sizeRequestSimpl (Requisition *requisition)
 Simple variant, to be implemented by widgets with sizes not depending on positions. More...
 
virtual void getExtremesImpl (Extremes *extremes, int numPos, Widget **references, int *x, int *y)
 See Sizes of Dillo Widgets. More...
 
virtual void calcExtraSpaceImpl (int numPos, Widget **references, int *x, int *y)
 The actual implementation for calculating dw::core::Widget::extraSpace. More...
 
virtual void correctRequisitionOfChild (Widget *child, Requisition *requisition, void(*splitHeightFun)(int, int *, int *), bool allowDecreaseWidth, bool allowDecreaseHeight)
 
void correctReqWidthOfChild (Widget *child, Requisition *requisition, bool allowDecreaseWidth)
 
void correctReqHeightOfChild (Widget *child, Requisition *requisition, void(*splitHeightFun)(int, int *, int *), bool allowDecreaseHeight)
 
virtual void correctExtremesOfChild (Widget *child, Extremes *extremes, bool useAdjustmentWidth)
 
virtual bool affectedByContainerSizeChange ()
 
virtual bool affectsSizeChangeContainerChild (Widget *child)
 
virtual bool usesAvailHeight ()
 Must be implemengted by a method returning true, when getAvailHeight() is called. More...
 
char * addAnchor (const char *name)
 
char * addAnchor (const char *name, int y)
 
void changeAnchor (char *name, int y)
 
void removeAnchor (char *name)
 
void setCursor (style::Cursor cursor)
 
bool selectionHandleEvent (SelectionState::EventType eventType, Iterator *it, int charPos, int linkNo, MousePositionEvent *event)
 
- Protected Member Functions inherited from lout::identity::IdentifiableObject
void registerName (const char *className, int *classId)
 This method must be called in the constructor for the sub class. See class comment for details. More...
 

Static Protected Member Functions

static int getSpaceShrinkability (struct Word *word)
 
static int getSpaceStretchability (struct Word *word)
 
- Static Protected Member Functions inherited from dw::oof::OOFAwareWidget
static int getOOFMIndex (Widget *widget)
 
static bool isOOFContainer (Widget *widget, int oofmIndex)
 

Protected Attributes

bool hasListitemValue
 
int leftInnerPadding
 
int line1Offset
 
int line1OffsetEff
 
bool ignoreLine1OffsetSometimes
 
bool mustQueueResize
 
bool limitTextWidth
 
int redrawY
 
int lastWordDrawn
 
core::SizeParams sizeRequestParams
 
int lineBreakWidth
 
int wrapRefLines
 
int wrapRefParagraphs
 
int wrapRefLinesFCX
 
int wrapRefLinesFCY
 
bool newLineHasFloatLeft
 
bool newLineHasFloatRight
 
int newLineLeftBorder
 
int newLineRightBorder
 
int newLineLeftFloatHeight
 
int newLineRightFloatHeight
 
int newLineAscent
 
int newLineDescent
 
lout::misc::SimpleVector< Line > * lines
 
lout::misc::SimpleVector
< Paragraph > * 
paragraphs
 
int nonTemporaryLines
 
lout::misc::NotSoSimpleVector
< Word > * 
words
 
lout::misc::SimpleVector
< Anchor > * 
anchors
 
struct {
   int   index
 
   int   nChar
 
hlStart [core::HIGHLIGHT_NUM_LAYERS]
 
struct {
   int   index
 
   int   nChar
 
hlEnd [core::HIGHLIGHT_NUM_LAYERS]
 
int hoverLink
 
int numSizeReferences
 
WidgetsizeReferences [NUM_OOFM]
 
- Protected Attributes inherited from dw::oof::OOFAwareWidget
OOFAwareWidgetoofContainer [NUM_OOFM]
 
OutOfFlowMgroutOfFlowMgr [NUM_OOFM]
 
core::Requisition requisitionWithoutOOF
 
- Protected Attributes inherited from dw::core::Widget
WidgetImgRendererwidgetImgRenderer
 
Allocation allocation
 The current allocation: size and position, always relative to the canvas. More...
 
Layoutlayout
 
style::Box extraSpace
 Space around the margin box. Allocation is extraSpace + margin + border + padding + contents. More...
 
StackingContextMgrstackingContextMgr
 Set iff this widget constitutes a stacking context, as defined by CSS. More...
 
WidgetstackingContextWidget
 The bottom-most ancestor (or this) for which stackingContextMgr is set. More...
 

Static Protected Attributes

static int penalties [PENALTY_NUM][2]
 
static int stretchabilityFactor = 100
 
- Static Protected Attributes inherited from dw::oof::OOFAwareWidget
static const char * OOFM_NAME [NUM_OOFM]
 

Private Types

enum  { PENALTY_FORCE_BREAK = INT_MIN, PENALTY_PROHIBIT_BREAK = INT_MAX }
 
enum  { PENALTY_HYPHEN, PENALTY_EM_DASH_LEFT, PENALTY_EM_DASH_RIGHT, PENALTY_NUM }
 
enum  { NUM_DIV_CHARS = 4 }
 

Static Private Attributes

static DivChar divChars [NUM_DIV_CHARS]
 
static const char * hyphenDrawChar = "-"
 

Friends

class TextblockIterator
 

Additional Inherited Members

- Public Types inherited from dw::oof::OOFAwareWidget
enum  {
  SL_START, SL_BACKGROUND, SL_SC_BOTTOM, SL_IN_FLOW,
  SL_OOF_REF, SL_OOF_CONT, SL_SC_TOP, SL_END
}
 
- Public Attributes inherited from dw::core::Widget
int parentRef
 This value is defined by the parent widget, and used for incremential resizing. More...
 
- Protected Types inherited from dw::oof::OOFAwareWidget
enum  {
  OOFM_FLOATS, OOFM_ABSOLUTE, OOFM_RELATIVE, OOFM_FIXED,
  NUM_OOFM
}
 
enum  { PARENT_REF_OOFM_BITS = 3, PARENT_REF_OOFM_MASK = (1 << PARENT_REF_OOFM_BITS) - 1 }
 
- Protected Types inherited from dw::core::Widget
enum  Flags {
  RESIZE_QUEUED = 1 << 0, EXTREMES_QUEUED = 1 << 1, NEEDS_RESIZE = 1 << 2, NEEDS_ALLOCATE = 1 << 3,
  ALLOCATE_QUEUED = 1 << 4, EXTREMES_CHANGED = 1 << 5, WAS_ALLOCATED = 1 << 6
}
 

Detailed Description

A Widget for rendering text blocks, i.e. paragraphs or sequences of paragraphs.

Info: Some (not so) recent changes, line breaking and hyphenation, have not yet been incorporated into this documentation. See Changes in Line-Breaking and Hyphenation.

Signals

dw::Textblock uses the signals defined in dw::core::Layout::LinkReceiver, related to links. The coordinates are always -1.

Collapsing Spaces

Info: Collapsing spaces are deprecated, in favor of collapsing margins (see below).

The idea behind this is that every paragraph has a specific vertical space around and that they are combined to one space, according to rules stated below. A paragraph consists either of the lines between two paragraph breaks within a dw::Textblock, or of a dw::Textblock within a dw::Textblock, in a single line; the latter is used for indented boxes and list items.

The rules:

  1. If a paragraph is following by another, the space between them is the maximum of both box spaces:

    dw-textblock-collapsing-spaces-1-1.png

    are combined like this:

    dw-textblock-collapsing-spaces-1-2.png

  2. a) If one paragraph is the first paragraph within another, the upper space of these paragraphs collapse. b) The analogue is the case for the last box:

    dw-textblock-collapsing-spaces-2-1.png

    If B and C are put into A, the result is:

    dw-textblock-collapsing-spaces-2-2.png

For achieving this, there are some features of dw::Textblock:

Collapsing Margins

Collapsing margins, as defined in the CSS2 specification, are, supported in addition to collapsing spaces. Also, spaces and margins collapse themselves. I. e., the space between two paragraphs is the maximum of the space calculated as described in "Collapsing Spaces" and the space calculated according to the rules for collapsing margins.

(This is an intermediate hybrid state, collapsing spaces are used in the current version of dillo, while I implemented collapsing margins for the CSS prototype and integrated it already into the main trunk. For a pure CSS-based dillo, collapsing spaces will not be needed anymore, and may be removed for simplicity.)

Currently implemented cases:

Open issues:

Some Internals

There are 4 lists, dw::Textblock::words, dw::Textblock::paragraphs, dw::Textblock::lines, and dw::Textblock::anchors. The word list is quite static; only new words may be added. A word is either text, a widget, or a break.

Lines refer to the word list (first and last). They are completely redundant, i.e., they can be rebuilt from the words. Lines can be rewrapped either completely or partially (see "Incremental Resizing" below). For the latter purpose, several values are accumulated in the lines. See dw::Textblock::Line for details.

A recent change was the introduction of the paragraphs list, which works quite similar, is also redundant, but is used to calculate the extremes, not the size.

Anchors associate the anchor name with the index of the next word at the point of the anchor.

Incremental Resizing

dw::Textblock makes use of incremental resizing as described in Sizes of Dillo Widgets. The parentRef is, for children of a dw::Textblock, simply the number of the line. [Update: Incorrect; see Handling Elements Out Of Flow.]

Generally, there are three cases which may change the size of the widget:

The state of the size calculation is stored in wrapRef within dw::Textblock, which has the value -1 if no rewrapping of lines necessary, or otherwise the line from which a rewrap is necessary.

Widgets Ouf Of Flow

See

Member Enumeration Documentation

anonymous enum
private

This class encapsulates the badness/penalty calculation, and so (i) makes changes (hopefully) simpler, and (ii) hides the integer arithmetic (floating point arithmetic avoided for performance reasons). Unfortunately, the value range of the badness is not well defined, so fiddling with the penalties is a bit difficult.

Enumerator
PENALTY_FORCE_BREAK 
PENALTY_PROHIBIT_BREAK 
anonymous enum
private
Enumerator
PENALTY_HYPHEN 
PENALTY_EM_DASH_LEFT 
PENALTY_EM_DASH_RIGHT 
PENALTY_NUM 
anonymous enum
private
Enumerator
NUM_DIV_CHARS 

Constructor & Destructor Documentation

dw::Textblock::Textblock ( bool  limitTextWidth)
dw::Textblock::~Textblock ( )

Member Function Documentation

void dw::Textblock::accumulateWordData ( int  wordIndex)
protected
void dw::Textblock::accumulateWordForLine ( int  lineIndex,
int  wordIndex 
)
protected
bool dw::Textblock::addAnchor ( const char *  name,
core::style::Style style 
)

Add an anchor to the page. "name" is copied, so no strdup is necessary for the caller.

Return true on success, and false, when this anchor had already been added to the widget tree.

Todo:
It may be necessary for future uses to save the anchor in some way, e.g. when parts of the widget tree change.

References lout::misc::boolToStr(), DBG_OBJ_ENTER, DBG_OBJ_LEAVE_VAL, dw::Textblock::Anchor::name, and dw::Textblock::Anchor::wordIndex.

Referenced by textTimeout().

void dw::Textblock::addBreakOption ( core::style::Style style,
bool  forceBreak 
)

Add a break option (see setBreakOption() for details). Used instead of addSpace for ideographic characters.

When "forceBreak" is true, a break is even possible within PRE etc.

References DBG_OBJ_ENTER, DBG_OBJ_LEAVE, and DBG_SET_WORD.

Textblock::Line * dw::Textblock::addLine ( int  firstWord,
int  lastWord,
int  newLastOofPos,
bool  temporary,
int  minHeight 
)
protected
void dw::Textblock::addLinebreak ( core::style::Style style)
void dw::Textblock::addParbreak ( int  space,
core::style::Style style 
)
void dw::Textblock::addSpace ( core::style::Style style)
void dw::Textblock::addText ( const char *  text,
size_t  len,
core::style::Style style 
)

Add a word to the page structure. If it contains dividing characters (hard or soft hyphens, em-dashes, etc.), it is divided.

References DBG_OBJ_ENTER, DBG_OBJ_LEAVE, DBG_SET_WORD, dw::core::style::StyleAttrs::font, dw::Textblock::Word::hyphenWidth, layout, lout::unicode::nextUtf8Char(), PRINTF, PUTCHAR, and dw::Textblock::Word::style.

Referenced by addText(), addTextToFloatTimeout(), dw::ListItem::initWithText(), main(), and textTimeout().

void dw::Textblock::addText ( const char *  text,
core::style::Style style 
)
inline

References addText().

void dw::Textblock::addText0 ( const char *  text,
size_t  len,
short  flags,
core::style::Style style,
core::Requisition size 
)
protected
void dw::Textblock::addWidget ( core::Widget widget,
core::style::Style style 
)
Textblock::Word * dw::Textblock::addWord ( int  width,
int  ascent,
int  descent,
short  flags,
core::style::Style style 
)
protected

Add a new word (text, widget etc.) to a page.

References DBG_OBJ_ENTER, DBG_OBJ_LEAVE, and DBG_OBJ_SET_NUM.

bool dw::Textblock::affectsSizeChangeContainerChild ( Widget child)
protected
void dw::Textblock::alignLine ( int  lineIndex)
protected
void dw::Textblock::balanceBreakPosAndHeight ( int  wordIndex,
int  firstIndex,
int *  searchUntil,
bool  tempNewLine,
int  penaltyIndex,
bool  borderIsCalculated,
bool *  thereWillBeMoreSpace,
bool  wrapAll,
int *  diffWords,
int *  wordIndexEnd,
int *  lastFloatPos,
bool  regardBorder,
int *  height,
int *  breakPos 
)
protected
void dw::Textblock::breakAdded ( )
protected

Called directly after a (line or paragraph) break has been added.

bool dw::Textblock::buttonPressImpl ( core::EventButton event)
protectedvirtual

Reimplemented from dw::core::Widget.

bool dw::Textblock::buttonReleaseImpl ( core::EventButton event)
protectedvirtual

Reimplemented from dw::core::Widget.

void dw::Textblock::calcBorders ( int  lastOofRef,
int  height 
)
protected
void dw::Textblock::calcExtraSpaceImpl ( int  numPos,
Widget **  references,
int *  x,
int *  y 
)
protected
int dw::Textblock::calcLineBreakWidth ( int  lineIndex)
protected
int dw::Textblock::calcLinePartHeight ( int  firstWord,
int  lastWord 
)
protected
int dw::Textblock::calcPenaltyIndexForNewLine ( )
inlineprotected
bool dw::Textblock::calcSizeOfWidgetInFlow ( int  wordIndex,
Widget widget,
core::Requisition size 
)
protected
void dw::Textblock::calcTextOffset ( int  lineIndex,
int  totalWidth 
)
protected
void dw::Textblock::calcTextSize ( const char *  text,
size_t  len,
core::style::Style style,
core::Requisition size,
bool  isStart,
bool  isEnd 
)
protected
void dw::Textblock::calcTextSizes ( const char *  text,
size_t  textLen,
core::style::Style style,
int  numBreaks,
int *  breakPos,
core::Requisition wordSize 
)
protected
int dw::Textblock::calcVerticalBorder ( int  widgetPadding,
int  widgetBorder,
int  widgetMargin,
int  lineBorderTotal,
int  lineMarginTotal 
)
protected

References DBG_OBJ_ENTER, and DBG_OBJ_LEAVE_VAL.

void dw::Textblock::changeLinkColor ( int  link,
int  newColor 
)
void dw::Textblock::changeWordStyle ( int  from,
int  to,
core::style::Style style,
bool  includeFirstSpace,
bool  includeLastSpace 
)
void dw::Textblock::cleanupWord ( int  wordNo)
protected
void dw::Textblock::clearPositionChanged ( )
virtual

TODO Needed after SRDOP?

Reimplemented from dw::oof::OOFAwareWidget.

References DBG_OBJ_ENTER0, and DBG_OBJ_LEAVE.

int dw::Textblock::considerHyphenation ( int  firstIndex,
int  breakPos 
)
protected

Suggest a word to hyphenate, when breaking at breakPos is planned. Return a word index or -1, when hyphenation makes no sense.

References dw::Textblock::Word::badnessAndPenalty, dw::Textblock::BadnessAndPenalty::lineLoose(), and dw::Textblock::BadnessAndPenalty::lineTight().

void dw::Textblock::containerSizeChangedForChildren ( )
protectedvirtual
void dw::Textblock::correctLastWordExtremes ( )
protected
void dw::Textblock::decorateText ( core::View view,
core::style::Style style,
core::style::Color::Shading  shading,
int  x,
int  yBase,
int  width 
)
protected
void dw::Textblock::drawLevel ( core::View view,
core::Rectangle area,
int  level,
core::DrawingContext context 
)
protectedvirtual
void dw::Textblock::drawLine ( Line line,
core::View view,
core::Rectangle area,
core::DrawingContext context 
)
protected
void dw::Textblock::drawSpace ( int  wordIndex,
core::View view,
core::Rectangle area,
int  xWidget,
int  yWidgetBase 
)
protected
void dw::Textblock::drawText ( core::View view,
core::style::Style style,
core::style::Color::Shading  shading,
int  x,
int  y,
const char *  text,
int  start,
int  len,
bool  isStart,
bool  isEnd 
)
protected
void dw::Textblock::drawWord ( Line line,
int  wordIndex1,
int  wordIndex2,
core::View view,
core::Rectangle area,
int  xWidget,
int  yWidgetBase 
)
protected

Draw a word of text.

Since hyphenated words consist of multiple instance of dw::Textblock::Word, which should be drawn as a whole (to preserve kerning etc.; see Changes in Line-Breaking and Hyphenation), two indices are passed. See also drawLine(), where drawWord() is called.

References dw::Textblock::Line::borderAscent, dw::Textblock::Line::borderDescent, dw::Textblock::Word::content, dw::core::style::StyleAttrs::hasBackground(), dw::Textblock::Line::lastWord, dw::Textblock::Word::size, dw::core::Content::text, and dw::core::Requisition::width.

void dw::Textblock::drawWord0 ( int  wordIndex1,
int  wordIndex2,
const char *  text,
int  totalWidth,
bool  drawHyphen,
core::style::Style style,
core::View view,
core::Rectangle area,
int  xWidget,
int  yWidgetBase 
)
protected
void dw::Textblock::enterNotifyImpl ( core::EventCrossing event)
protectedvirtual

Reimplemented from dw::core::Widget.

void dw::Textblock::fillParagraphs ( )
protected

Counter part to rewrap(), but for extremes, not size calculation.

References DBG_OBJ_ENTER0, DBG_OBJ_LEAVE, DBG_OBJ_MSGF, DBG_OBJ_SET_NUM, lout::misc::max(), and lout::misc::min().

void dw::Textblock::fillSpace ( int  wordNo,
core::style::Style style 
)
protected
void dw::Textblock::fillWord ( int  wordNo,
int  width,
int  ascent,
int  descent,
short  flags,
core::style::Style style 
)
protected
int dw::Textblock::findLineIndex ( int  y)
protected

Find the first line index that includes y, which is given in widget coordinates.

int dw::Textblock::findLineIndex ( int  y,
int  ascent 
)
protected
int dw::Textblock::findLineIndexWhenAllocated ( int  y)
protected
int dw::Textblock::findLineIndexWhenNotAllocated ( int  y)
protected
int dw::Textblock::findLineOfWord ( int  wordIndex)
protected

Find the line of word wordIndex.

Referenced by dw::Textblock::TextblockIterator::getAllocation().

int dw::Textblock::findParagraphOfWord ( int  wordIndex)
protected

Find the paragraph of word wordIndex.

bool dw::Textblock::findSizeRequestReference ( Widget reference,
int *  xRef = NULL,
int *  yRef = NULL 
)
protected
bool dw::Textblock::findSizeRequestReference ( int  oofmIndex,
int *  xRef = NULL,
int *  yRef = NULL 
)
inlineprotected
Textblock::Word * dw::Textblock::findWord ( int  x,
int  y,
bool *  inSpace 
)
protected
void dw::Textblock::flush ( )
int dw::Textblock::getAvailHeightOfChild ( core::Widget child,
bool  forceValue 
)
protectedvirtual
int dw::Textblock::getAvailWidthOfChild ( core::Widget child,
bool  forceValue 
)
protectedvirtual
core::Widget * dw::Textblock::getExtremesReference ( int  index)
protectedvirtual
void dw::Textblock::getExtremesSimpl ( core::Extremes extremes)
protectedvirtual
int dw::Textblock::getGeneratorRest ( int  oofmIndex)
protected
int dw::Textblock::getGeneratorWidth ( int  callerX,
int  callerWidth 
)
virtual

Return width including margin/border/padding Called by OOFFloatsMgr to position floats.

In somce cases (as in dw::Textblock::getGeneratorRest), the value is not up to date; for this, the caller may pass its position relative to this widget, as well as its width, which are used for adjustments. (See comment in dw::Textblock::getGeneratorRest.)

Reimplemented from dw::oof::OOFAwareWidget.

References DBG_OBJ_ENTER, DBG_OBJ_LEAVE_VAL, lout::misc::max(), lout::misc::min(), and dw::tablecell::usesMaxGeneratorWidth().

int dw::Textblock::getGeneratorX ( int  oofmIndex)
virtual

Return position relative to container, not regarding margin/border/padding, Called by OOFFloatsMgr to position floats.

Reimplemented from dw::oof::OOFAwareWidget.

References lout::misc::assertNotReached(), DBG_OBJ_ENTER, and DBG_OBJ_LEAVE_VAL.

int dw::Textblock::getGeneratorY ( int  oofmIndex)
virtual

Return position relative to container, not regarding margin/border/padding, Called by OOFFloatsMgr to position floats.

Reimplemented from dw::oof::OOFAwareWidget.

References lout::misc::assertNotReached(), DBG_OBJ_ENTER, and DBG_OBJ_LEAVE_VAL.

int dw::Textblock::getLineShrinkability ( int  lastWordIndex)
protected
int dw::Textblock::getLineStretchability ( int  lastWordIndex)
protected
int dw::Textblock::getMaxGeneratorWidth ( )
virtual

Reimplemented from dw::oof::OOFAwareWidget.

References DBG_OBJ_ENTER0, and DBG_OBJ_LEAVE_VAL.

int dw::Textblock::getSpaceShrinkability ( struct Word word)
staticprotected
int dw::Textblock::getSpaceStretchability ( struct Word word)
staticprotected
core::Widget * dw::Textblock::getWidgetAtPointLevel ( int  x,
int  y,
int  level,
core::GettingWidgetAtPointContext context 
)
protectedvirtual
RegardingBorder * dw::Textblock::getWidgetRegardingBorderForLine ( Line line)
protected
RegardingBorder * dw::Textblock::getWidgetRegardingBorderForLine ( int  lineNo)
protected
RegardingBorder * dw::Textblock::getWidgetRegardingBorderForLine ( int  firstWord,
int  lastWord 
)
protected
void dw::Textblock::getWordExtremes ( Word word,
core::Extremes extremes 
)
protected
void dw::Textblock::handleWordExtremes ( int  wordIndex)
protected
void dw::Textblock::handOverBreak ( core::style::Style style)

This function "hands" the last break of a page "over" to a parent page. This is used for "collapsing spaces".

References addParbreak(), dw::Textblock::Line::breakSpace, and dw::core::style::DISPLAY_BLOCK.

int dw::Textblock::hyphenateWord ( int  wordIndex,
int *  addIndex1 = NULL 
)
protected
void dw::Textblock::initLine1Offset ( int  wordIndex)
protected
void dw::Textblock::initNewLine ( )
protected
void dw::Textblock::initWord ( int  wordNo)
protected
bool dw::Textblock::isBlockLevel ( )
protectedvirtual

Reimplemented from dw::core::Widget.

bool dw::Textblock::isBreakAllowed ( core::style::Style style)
protected
bool dw::Textblock::isBreakAllowedInWord ( Word word)
inlineprotected
bool dw::Textblock::isHyphenationCandidate ( Word word)
protected
bool dw::Textblock::isPossibleOOFContainer ( int  oofmIndex)
virtual

Reimplemented from dw::oof::OOFAwareWidget.

bool dw::Textblock::isPossibleOOFContainerParent ( int  oofmIndex)
virtual

Reimplemented from dw::oof::OOFAwareWidget.

core::Iterator * dw::Textblock::iterator ( core::Content::Type  mask,
bool  atEnd 
)
virtual

Return an iterator for this widget.

mask can narrow the types returned by the iterator, this can enhance performance quite much, e.g. when only searching for child widgets.

With atEnd == false, the iterator starts before the beginning, i.e. the first call of dw::core::Iterator::next will let the iterator point on the first piece of contents. Likewise, With atEnd == true, the iterator starts after the last piece of contents, call dw::core::Iterator::prev in this case.

Implements dw::core::Widget.

void dw::Textblock::justifyLine ( Line line,
int  diff 
)
protected
void dw::Textblock::leaveNotifyImpl ( core::EventCrossing event)
protectedvirtual

Reimplemented from dw::core::Widget.

References layout, and dw::core::style::Tooltip::onLeave().

int dw::Textblock::lineYOffsetCanvas ( Line line,
core::Allocation allocation 
)
inlineprotected
int dw::Textblock::lineYOffsetCanvas ( Line line)
inlineprotected
int dw::Textblock::lineYOffsetCanvas ( int  lineIndex)
inlineprotected
int dw::Textblock::lineYOffsetWidget ( Line line,
core::Allocation allocation 
)
inlineprotected
int dw::Textblock::lineYOffsetWidget ( Line line)
inlineprotected
int dw::Textblock::lineYOffsetWidget ( int  lineIndex)
inlineprotected
int dw::Textblock::lineYOffsetWidget ( int  lineIndex,
core::Allocation allocation 
)
inlineprotected
void dw::Textblock::markExtremesChange ( int  ref)
protectedvirtual
void dw::Textblock::markSizeChange ( int  ref)
protectedvirtual
bool dw::Textblock::motionNotifyImpl ( core::EventMotion event)
protectedvirtual
void dw::Textblock::moveWordIndices ( int  wordIndex,
int  num,
int *  addIndex1 = NULL 
)
protected
static bool dw::Textblock::mustAddBreaks ( core::style::Style style)
inlinestatic
bool dw::Textblock::mustBorderBeRegarded ( Line line)
inlineprotected

Of nested text blocks, only the most inner one must regard the borders of floats.

References getWidgetRegardingBorderForLine().

Referenced by dw::Textblock::TextblockIterator::getAllocation().

bool dw::Textblock::mustBorderBeRegarded ( int  lineNo)
inlineprotected
void dw::Textblock::notifySetAsTopLevel ( )
protectedvirtual

This method is called after a widget has been set as the top of a widget tree.

A widget may override this method when it is necessary to be notified.

Reimplemented from dw::oof::OOFAwareWidget.

References DBG_OBJ_SET_NUM.

void dw::Textblock::notifySetParent ( )
protectedvirtual

This method is called after a widget has been added to a parent.

A widget may override this method when it is necessary to be notified.

Reimplemented from dw::oof::OOFAwareWidget.

References DBG_OBJ_ARRSET_PTR, and DBG_OBJ_SET_NUM.

int dw::Textblock::numGetExtremesReferences ( )
protectedvirtual
int dw::Textblock::numSizeRequestReferences ( )
protectedvirtual
void dw::Textblock::oofSizeChanged ( bool  extremesChanged)
virtual

Called by an implementation of dw::oof::OutOfFlowMgr when the size of the container has changed, typically in sizeAllocateEnd.

Reimplemented from dw::oof::OOFAwareWidget.

References DBG_OBJ_ENTER, DBG_OBJ_LEAVE, and dw::tablecell::usesMaxGeneratorWidth().

void dw::Textblock::processWord ( int  wordIndex)
protected
void dw::Textblock::queueDrawRange ( int  index1,
int  index2 
)
protected
void dw::Textblock::removeChild ( Widget child)
protected
Bug:
Not implemented.
void dw::Textblock::removeSpaceImgRenderer ( int  wordNo)
protected
void dw::Textblock::removeTemporaryLines ( )
protected
void dw::Textblock::removeWordImgRenderer ( int  wordNo)
protected
void dw::Textblock::resizeDrawImpl ( )
protectedvirtual

Called after sizeAllocateImpl() to redraw necessary areas. By default the whole widget is redrawn.

Reimplemented from dw::core::Widget.

References DBG_OBJ_ENTER0, DBG_OBJ_LEAVE, DBG_OBJ_SET_NUM, and dw::Textblock::Line::lastWord.

void dw::Textblock::rewrap ( )
protected

Rewrap the page from the line from which this is necessary. There are basically two times we'll want to do this: either when the viewport is resized, or when the size changes on one of the child widgets.

References dw::oof::OutOfFlowMgr::calcWidgetRefSize(), dw::Textblock::Word::content, DBG_OBJ_ENTER0, DBG_OBJ_LEAVE, DBG_OBJ_MSG, DBG_OBJ_MSGF, DBG_OBJ_SET_NUM, DBG_SET_WORD_SIZE, dw::Textblock::Line::lastWord, lout::misc::min(), dw::Textblock::Word::size, dw::core::Content::type, dw::core::WidgetReference::widget, dw::core::Content::widget, and dw::core::Content::widgetReference.

int dw::Textblock::searchBreakPos ( int  wordIndex,
int  firstIndex,
int *  searchUntil,
bool  tempNewLine,
int  penaltyIndex,
bool  thereWillBeMoreSpace,
bool  wrapAll,
int *  diffWords,
int *  wordIndexEnd,
int *  addIndex1 = NULL 
)
protected
int dw::Textblock::searchMinBap ( int  firstWord,
int  lastWordm,
int  penaltyIndex,
bool  thereWillBeMoreSpace,
bool  correctAtEnd 
)
protected
bool dw::Textblock::sendSelectionEvent ( core::SelectionState::EventType  eventType,
core::MousePositionEvent event 
)
protected
void dw::Textblock::setBreakOption ( Word word,
core::style::Style style,
int  breakPenalty1,
int  breakPenalty2,
bool  forceBreak 
)
protected

Set a break option, if allowed by the style. Called by fillSpace (and so addSpace), but may be called, via addBreakOption(), as an alternative, e. g. for ideographic characters.

References dw::Textblock::Word::badnessAndPenalty, DBG_OBJ_ENTER, DBG_OBJ_LEAVE, dw::Textblock::BadnessAndPenalty::lineMustBeBroken(), dw::Textblock::BadnessAndPenalty::setPenalties(), and dw::Textblock::BadnessAndPenalty::setPenalty().

void dw::Textblock::setPenaltyEmDashLeft ( int  penaltyLeftEmDash)
static
void dw::Textblock::setPenaltyEmDashRight ( int  penaltyRightEmDash)
static
void dw::Textblock::setPenaltyEmDashRight2 ( int  penaltyRightEmDash2)
static
void dw::Textblock::setPenaltyHyphen ( int  penaltyHyphen)
static
void dw::Textblock::setPenaltyHyphen2 ( int  penaltyHyphen2)
static
void dw::Textblock::setSpaceImgRenderer ( int  wordNo)
protected
void dw::Textblock::setStretchabilityFactor ( int  stretchabilityFactor)
static
void dw::Textblock::setWordImgRenderer ( int  wordNo)
protected
void dw::Textblock::showMissingLines ( )
protected
void dw::Textblock::sizeAllocateImpl ( core::Allocation allocation)
protectedvirtual
void dw::Textblock::sizeRequestImpl ( core::Requisition requisition,
int  numPos,
Widget **  references,
int *  x,
int *  y 
)
protected
core::Widget * dw::Textblock::sizeRequestReference ( int  index)
protectedvirtual
int dw::Textblock::textWidth ( const char *  text,
int  start,
int  len,
core::style::Style style,
bool  isStart,
bool  isEnd 
)
protected
void dw::Textblock::updateReference ( int  ref)
virtual

...

Reimplemented from dw::oof::OOFAwareWidget.

bool dw::Textblock::usesAvailWidth ( )
protectedvirtual

Must be implemengted by a method returning true, when getAvailWidth() is called.

Reimplemented from dw::core::Widget.

bool dw::Textblock::usesMaxGeneratorWidth ( )
virtual
void dw::Textblock::widgetRefSizeChanged ( int  externalIndex)
virtual

Called by an implementation of dw::oof::OutOfFlowMgr (actually only OOFPosRelMgr) for the generator of a widget out of flow, when the reference size has changed. (The size of the reference is 0 * 0 for all other implementations of dw::oof::OutOfFlowMgr.)

Reimplemented from dw::oof::OOFAwareWidget.

int dw::Textblock::wordWrap ( int  wordIndex,
bool  wrapAll 
)
protectedvirtual
int dw::Textblock::wrapWordInFlow ( int  wordIndex,
bool  wrapAll 
)
protected
int dw::Textblock::wrapWordOofRef ( int  wordIndex,
bool  wrapAll 
)
protected
int dw::Textblock::yOffsetOfLineCreated ( Line line)
protected

Includes margin, border, and padding. Can be used without allocation.

References dw::Textblock::Line::borderAscent, DBG_OBJ_ENTER0, DBG_OBJ_LEAVE_VAL, dw::Textblock::Line::marginAscent, and dw::Textblock::Line::top.

int dw::Textblock::yOffsetOfLineToBeCreated ( int *  lastMargin = NULL)
protected

Friends And Related Function Documentation

friend class TextblockIterator
friend

Member Data Documentation

lout::misc::SimpleVector<Anchor>* dw::Textblock::anchors
protected
int dw::Textblock::CLASS_ID = -1
static
Textblock::DivChar dw::Textblock::divChars
staticprivate
Initial value:
= {
{ "\xc2\xad", true, false, true, PENALTY_HYPHEN, -1 },
{ "-", false, true, true, -1, PENALTY_HYPHEN },
{ "\xe2\x80\x90", false, true, true, -1, PENALTY_HYPHEN },
{ "\xe2\x80\x94", false, true, false,
}
bool dw::Textblock::hasListitemValue
protected
struct { ... } dw::Textblock::hlEnd[core::HIGHLIGHT_NUM_LAYERS]
struct { ... } dw::Textblock::hlStart[core::HIGHLIGHT_NUM_LAYERS]
int dw::Textblock::hoverLink
protected
const char * dw::Textblock::hyphenDrawChar = "-"
staticprivate

The character which is used to draw a hyphen at the end of a line, either caused by automatic hyphenation, or by soft hyphens.

Initially, soft hyphens were used, but they are not drawn on some platforms. Also, unconditional hyphens (U+2010) are not available in many fonts; so, a simple hyphen-minus is used.

bool dw::Textblock::ignoreLine1OffsetSometimes
protected
int dw::Textblock::index
int dw::Textblock::lastWordDrawn
protected
int dw::Textblock::leftInnerPadding
protected
bool dw::Textblock::limitTextWidth
protected
int dw::Textblock::line1Offset
protected
int dw::Textblock::line1OffsetEff
protected
int dw::Textblock::lineBreakWidth
protected
lout::misc::SimpleVector<Line>* dw::Textblock::lines
protected
bool dw::Textblock::mustQueueResize
protected

Referenced by addParbreak().

int dw::Textblock::nChar
int dw::Textblock::newLineAscent
protected
int dw::Textblock::newLineDescent
protected
bool dw::Textblock::newLineHasFloatLeft
protected
bool dw::Textblock::newLineHasFloatRight
protected
int dw::Textblock::newLineLeftBorder
protected
int dw::Textblock::newLineLeftFloatHeight
protected
int dw::Textblock::newLineRightBorder
protected
int dw::Textblock::newLineRightFloatHeight
protected
int dw::Textblock::nonTemporaryLines
protected
int dw::Textblock::numSizeReferences
protected
lout::misc::SimpleVector<Paragraph>* dw::Textblock::paragraphs
protected
int dw::Textblock::penalties
staticprotected
Initial value:
= {
{ 100, 800 },
{ 800, 800 },
{ 100, 800 }
}

The penalties for hyphens and other, multiplied by 100. So, 100 means 1.0. INT_MAX and INT_MIN are also allowed. See dw::Textblock::BadnessAndPenalty::setPenalty for more details. Set from preferences.

int dw::Textblock::redrawY
protected
Widget* dw::Textblock::sizeReferences[NUM_OOFM]
protected
core::SizeParams dw::Textblock::sizeRequestParams
protected
int dw::Textblock::stretchabilityFactor = 100
staticprotected

...

lout::misc::NotSoSimpleVector<Word>* dw::Textblock::words
protected
int dw::Textblock::wrapRefLines
protected
int dw::Textblock::wrapRefLinesFCX
protected
int dw::Textblock::wrapRefLinesFCY
protected
int dw::Textblock::wrapRefParagraphs
protected

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