Dillo
textblock.hh
Go to the documentation of this file.
1 #ifndef __DW_TEXTBLOCK_HH__
2 #define __DW_TEXTBLOCK_HH__
3 
4 #include <limits.h>
5 
6 #include "regardingborder.hh"
7 #include "../lout/misc.hh"
8 
9 // These were used when improved line breaking and hyphenation were implemented.
10 // Should be, bit by bit, replaced by RTFL (see ../lout/debug.hh).
11 #define PRINTF(fmt, ...)
12 #define PUTCHAR(ch)
13 
14 #ifdef DBG_RTFL
15 # define DEBUG
16 #endif
17 
18 namespace dw {
19 
206 {
207 private:
217  enum {
220  };
221 
223  {
224  private:
226  badnessState;
227  int ratio; // ratio is only defined when badness is defined
228  int badness, penalty[2];
229 
230  // For debugging: define DEBUG for more informations in print().
231 #ifdef DEBUG
232  int totalWidth, idealWidth, totalStretchability, totalShrinkability;
233 #endif
234 
235  // "Infinity levels" are used to represent very large numbers,
236  // including "quasi-infinite" numbers. A couple of infinity
237  // level and number can be mathematically represented as
238  //
239  // number * N ^ (infinity level)
240  //
241  // where N is a number which is large enough. Practically,
242  // infinity levels are used to circumvent limited ranges for
243  // integer numbers.
244 
245  // Here, all infinity levels have got special meanings.
246  enum {
247  INF_VALUE = 0, /* simple values */
248  INF_LARGE, /* large values, like QUITE_LOOSE */
249  INF_NOT_STRETCHABLE, /* reserved for NOT_STRECTHABLE */
250  INF_TOO_TIGHT, /* used for lines, which are too tight */
251  INF_PENALTIES, /* used for penalties */
253 
254  // That INF_PENALTIES is the last value means that an
255  // infinite penalty (breaking is prohibited) makes a break
256  // not possible at all, so that pre-formatted text
257  // etc. works.
258  };
259 
260  void setSinglePenalty (int index, int penalty);
261  int badnessValue (int infLevel);
262  int penaltyValue (int index, int infLevel);
263 
264  public:
265  void calcBadness (int totalWidth, int idealWidth,
266  int totalStretchability, int totalShrinkability);
267  inline void setPenalty (int penalty) { setPenalties (penalty, penalty); }
268  void setPenalties (int penalty1, int penalty2);
269 
270  // Rather for debugging:
271  inline int getPenalty (int i) { return penalty[i]; }
272 
273  bool lineLoose ();
274  bool lineTight ();
275  bool lineTooTight ();
276  bool lineMustBeBroken (int penaltyIndex);
277  bool lineCanBeBroken (int penaltyIndex);
278  int compareTo (int penaltyIndex, BadnessAndPenalty *other);
279 
281  };
282 
285  enum { NUM_DIV_CHARS = 4 };
286 
287  typedef struct
288  {
289  const char *s;
290  bool charRemoved, canBeHyphenated, unbreakableForMinWidth;
291  int penaltyIndexLeft, penaltyIndexRight;
292  } DivChar;
293 
295 
296  static const char *hyphenDrawChar;
297 
298 protected:
299 
305  {
306  protected:
309  bool dataSet;
310 
311  public:
312  WordImgRenderer (Textblock *textblock, int wordNo);
313  ~WordImgRenderer ();
314 
315  void setData (int xWordWidget, int lineNo);
316 
317  bool readyToDraw ();
318  void getBgArea (int *x, int *y, int *width, int *height);
319  void getRefArea (int *xRef, int *yRef, int *widthRef, int *heightRef);
321  void draw (int x, int y, int width, int height);
322  };
323 
325  {
326  public:
328  WordImgRenderer (textblock, wordNo) { }
329 
330  void getBgArea (int *x, int *y, int *width, int *height);
332  };
333 
334  struct Paragraph
335  {
336  int firstWord; /* first word's index in word vector */
337  int lastWord; /* last word's index in word vector */
338 
339  /*
340  * General remark: all values include the last hyphen width, but
341  * not the last space; these values are, however corrected, when
342  * another word is added.
343  *
344  * Also, as opposed to lines, paragraphs are created with the
345  * first, not the last word, so these values change when new
346  * words are added.
347  */
348 
349  int parMin; /* The sum of all word minima (plus spaces,
350  hyphen width etc.) since the last possible
351  break within this paragraph. */
354  int parMax; /* The sum of all word maxima in this
355  paragraph (plus spaces, hyphen width
356  etc.). */
358 
359  int maxParMin; /* Maximum of all paragraph minima (value of
360  "parMin"), including this paragraph. */
363  int maxParMax; /* Maximum of all paragraph maxima (value of
364  "parMax""), including this paragraph. */
366  };
367 
368  struct Line
369  {
370  int firstWord; /* first word's index in word vector */
371  int lastWord; /* last word's index in word vector */
372 
373 
374  int top; /* "top" is always relative to the top
375  of the first line, i.e.
376  page->lines[0].top is always 0. */
377  int marginAscent; /* Maximum of all total ascents
378  (including margin: hence the name)
379  of the words in this line. */
380  int marginDescent; /* Maximum of all total decents
381  (including margin: hence the name)
382  of the words in this line. */
383  int borderAscent; /* Maximum of all ascents minus margin
384  (but including padding and border:
385  hence the name) of the words in
386  this line. */
387  int borderDescent; /* Maximum of all descents minus margin
388  (but including padding and border:
389  hence the name) of the words in
390  this line. */
391  int contentAscent; /* ??? (depricated?) */
392  int contentDescent; /* ??? (depricated?) */
393  int breakSpace; /* Space between this line and the next one. */
394  int textOffset; /* ??? (to be documented) */
395 
402  inline int totalHeight (int marginNextLine)
403  { return borderAscent + borderDescent
404  // Collapsing of the margins of adjacent lines is done here:
405  + lout::misc::max (marginDescent - borderDescent, marginNextLine,
406  breakSpace); }
407 
408  /* Maximum of all line widths, including this line. Does not
409  * include the last space, but the last hyphen width. Please
410  * notice a change: until recently (before hyphenation and
411  * changed line breaking), the values were accumulated up to the
412  * last line, not this line.*/
414 
415  /* The word index of the last OOF reference (most importantly:
416  * float) whic is positioned before this line, or -1, if there
417  * is no OOF reference positioned before.
418  *
419  * **Important:** These references may still be part of this or
420  * even a following line, when positioned before (this is the
421  * reason this attribute exists); see \ref dw-out-of-flow. */
423 
426  };
427 
428  struct Word
429  {
430  enum {
435  DIV_CHAR_AT_EOL = 1 << 1,
438  PERM_DIV_CHAR = 1 << 2,
444  /* When calculating the minimal width (as part of extremes),
445  * do not consider this word as breakable. This flag is
446  * ignored when the line is actually broken. */
448  /* If a word represents a "real" text word, or (after
449  * hyphenation) the first part of a "real" text word, this
450  * flag is set. Plays a role for text transformation. */
451  WORD_START = 1 << 5,
452  /* If a word represents a "real" text word, or (after
453  * hyphenation) the last part of a "real" text word, this
454  * flag is set. Analogue to WORD_START. */
455  WORD_END = 1 << 6,
456  /* This word is put at the top of the line, and at the
457  * left. This is necessary if the size of a child widget
458  * depends on the position, which, on the other hand, cannot
459  * be determined before the whole line is broken. */
461  };
462 
463  /* TODO: perhaps add a xLeft? */
465  /* Space after the word, only if it's not a break: */
466  short origSpace; /* from font, set by addSpace */
467  short effSpace; /* effective space, set by wordWrap,
468  * used for drawing etc. */
469  short hyphenWidth; /* Additional width, when a word is part
470  * (except the last part) of a hyphenationed
471  * word. Has to be added to the width, when
472  * this is the last word of the line, and
473  * "hyphenWidth > 0" is also used to decide
474  * whether to draw a hyphen. */
475  short flags;
477 
478  // accumulated values, relative to the beginning of the line
479  int totalWidth; /* The sum of all word widths; plus all
480  spaces, excluding the one of this
481  word; plus the hyphen width of this
482  word (but of course, no hyphen
483  widths of previous words. In other
484  words: the value compared to the
485  ideal width of the line, if the line
486  would be broken after this word. */
488  int totalSpaceStretchability; // includes all *before* current word
489  int totalSpaceShrinkability; // includes all *before* current word
490  BadnessAndPenalty badnessAndPenalty; /* when line is broken after this
491  * word */
492 
494  core::style::Style *spaceStyle; /* initially the same as of the word,
495  later set by a_Dw_page_add_space */
496 
497  // These two are used rarely, so there is perhaps a way to store
498  // them which is consuming less memory.
501  };
502 
503  struct Anchor
504  {
505  char *name;
507  };
508 
509  class TextblockIterator: public OOFAwareWidgetIterator
510  {
511  protected:
512  int numContentsInFlow ();
513  void getContentInFlow (int index, core::Content *content);
514 
515  public:
517  bool atEnd);
518 
520  (Textblock *textblock, core::Content::Type mask, int wordIndex);
521 
523 
524  void highlight (int start, int end, core::HighlightLayer layer);
525  void unhighlight (int direction, core::HighlightLayer layer);
526  void getAllocation (int start, int end, core::Allocation *allocation);
527  };
528 
529  friend class TextblockIterator;
530 
531  /* These fields provide some ad-hoc-functionality, used by sub-classes. */
532  bool hasListitemValue; /* If true, the first word of the page is treated
533  specially (search in source). */
534  int leftInnerPadding; /* This is an additional padding on the left side
535  (used by ListItem). */
536  int line1Offset; /* This is an additional offset of the first line.
537  May be negative (shift to left) or positive
538  (shift to right). */
539  int line1OffsetEff; /* The "effective" value of line1_offset, may
540  differ from line1_offset when
541  ignoreLine1OffsetSometimes is set to true. */
542 
543  /* The following is really hackish: It is used for DwTableCell (see
544  * comment in dw_table_cell.c), to avoid too wide table columns. If
545  * set to true, it has following effects:
546  *
547  * (i) line1_offset is ignored in calculating the minimal width
548  * (which is used by DwTable!), and
549  * (ii) line1_offset is ignored (line1_offset_eff is set to 0),
550  * when line1_offset plus the width of the first word is
551  * greater than the the line break witdh.
552  *
553  * \todo Eliminate all these ad-hoc features by a new, simpler and
554  * more elegant design. ;-)
555  */
557 
559 
566  static int penalties[PENALTY_NUM][2];
567 
572 
573  bool limitTextWidth; /* from preferences */
574 
575  int redrawY;
577 
579 
580  /* This value is currently) set by setAscent(). */
582 
583  int wrapRefLines, wrapRefParagraphs; /* 0-based. Important: Both
584  are the line numbers, not
585  the value stored in
586  parentRef. */
588 
589  // These four values are calculated by containingBlock->outOfFlowMgr
590  // (when defined; otherwise, they are false, or 0, respectively), for
591  // the newly constructed line, only when needed: when a new line is
592  // added, or if something in the line currently constucted has
593  // changed, e. g. a float has been added.
594 
596  int newLineLeftBorder, newLineRightBorder; /* As returned by
597  outOfFlowMgr->get...Border,
598  or 0, if outOfFlowMgr
599  is NULL */
601 
602  // Ascent and descent of the newly constructed line, i. e. maximum
603  // of all words ascent/descent since the end of the last line. Not
604  // neccessary the ascent and descent of the newly added line, since
605  // not all words are added to it.
607 
613 
614  struct { int index, nChar; }
616 
617  int hoverLink; /* The link under the mouse pointer */
618 
621 
622  void queueDrawRange (int index1, int index2);
623  int calcVerticalBorder (int widgetPadding, int widgetBorder,
624  int widgetMargin, int lineBorderTotal,
625  int lineMarginTotal);
627  void justifyLine (Line *line, int diff);
628  Line *addLine (int firstWord, int lastWord, int newLastOofPos,
629  bool temporary, int minHeight);
630  void rewrap ();
631  void fillParagraphs ();
632  void initNewLine ();
633  void calcBorders (int lastOofRef, int height);
634  void showMissingLines ();
635  void removeTemporaryLines ();
636 
639  int x, int yBase, int width);
641  core::style::Color::Shading shading, int x, int y,
642  const char *text, int start, int len, bool isStart,
643  bool isEnd);
644  void drawWord (Line *line, int wordIndex1, int wordIndex2, core::View *view,
645  core::Rectangle *area, int xWidget, int yWidgetBase);
646  void drawWord0 (int wordIndex1, int wordIndex2,
647  const char *text, int totalWidth, bool drawHyphen,
649  core::Rectangle *area, int xWidget, int yWidgetBase);
650  void drawSpace (int wordIndex, core::View *view, core::Rectangle *area,
651  int xWidget, int yWidgetBase);
652  void drawLine (Line *line, core::View *view, core::Rectangle *area,
653  core::DrawingContext *context);
654 
655  int findLineIndex (int y);
656  int findLineIndexWhenNotAllocated (int y);
657  int findLineIndexWhenAllocated (int y);
658  int findLineIndex (int y, int ascent);
659  int findLineOfWord (int wordIndex);
660  int findParagraphOfWord (int wordIndex);
661  Word *findWord (int x, int y, bool *inSpace);
662 
663  Word *addWord (int width, int ascent, int descent, short flags,
665  void breakAdded ();
666  void initWord (int wordNo);
667  void cleanupWord (int wordNo);
668  void removeWordImgRenderer (int wordNo);
669  void setWordImgRenderer (int wordNo);
670  void removeSpaceImgRenderer (int wordNo);
671  void setSpaceImgRenderer (int wordNo);
672  void fillWord (int wordNo, int width, int ascent, int descent,
673  short flags, core::style::Style *style);
674  void fillSpace (int wordNo, core::style::Style *style);
676  int breakPenalty1, int breakPenalty2, bool forceBreak);
678  { return isBreakAllowed (word->style); }
680  int textWidth (const char *text, int start, int len,
681  core::style::Style *style, bool isStart, bool isEnd);
682  void calcTextSize (const char *text, size_t len, core::style::Style *style,
683  core::Requisition *size, bool isStart, bool isEnd);
684  bool calcSizeOfWidgetInFlow (int wordIndex, Widget *widget,
685  core::Requisition *size);
686  bool findSizeRequestReference (Widget *reference, int *xRef = NULL,
687  int *yRef = NULL);
688  bool findSizeRequestReference (int oofmIndex, int *xRef = NULL,
689  int *yRef = NULL)
690  { return findSizeRequestReference (oofContainer[oofmIndex], xRef, yRef); }
691 
696  inline bool mustBorderBeRegarded (Line *line)
697  {
698  return getWidgetRegardingBorderForLine (line) == NULL;
699  }
700 
701  inline bool mustBorderBeRegarded (int lineNo)
702  {
703  return getWidgetRegardingBorderForLine (lineNo) == NULL;
704  }
705 
706  // The following methods return the y offset of a line,
707  // - given as pointer or by index;
708  // - either within the canvas, or within this widget;
709  // - with allocation passed explicitely, or using the widget allocation
710  // (important: this is set *after* sizeRequestImpl is returning.
711 
713  {
714  return line->top + (allocation->ascent - lines->getRef(0)->borderAscent);
715  }
716 
717  inline int lineYOffsetWidget (Line *line)
718  {
719  return lineYOffsetWidget (line, &allocation);
720  }
721 
723  {
724  return allocation->y + lineYOffsetWidget (line, allocation);
725  }
726 
727  inline int lineYOffsetCanvas (Line *line)
728  {
729  return lineYOffsetCanvas (line, &allocation);
730  }
731 
732  inline int lineYOffsetWidget (int lineIndex)
733  {
734  return lineYOffsetWidget (lines->getRef (lineIndex));
735  }
736 
737  inline int lineYOffsetWidget (int lineIndex, core::Allocation *allocation)
738  {
739  return lineYOffsetWidget (lines->getRef (lineIndex), allocation);
740  }
741 
742  inline int lineYOffsetCanvas (int lineIndex)
743  {
744  return lineYOffsetCanvas (lines->getRef (lineIndex));
745  }
746 
748  {
749  if (lines->size() == 0)
750  return 0;
751  else {
752  Line *line = lines->getLastRef();
753  if (line->firstWord <= line->lastWord)
754  return
755  (words->getRef(line->lastWord)->flags &
757  else
758  // empty line
759  return 0;
760  }
761  }
762 
766  int lastWord);
767  int yOffsetOfLineToBeCreated (int *lastMargin = NULL);
768  int yOffsetOfLineCreated (Line *line);
769 
771  core::MousePositionEvent *event);
772 
773  void processWord (int wordIndex);
774 
775  virtual int wordWrap (int wordIndex, bool wrapAll);
776 
777  int wrapWordInFlow (int wordIndex, bool wrapAll);
778  int wrapWordOofRef (int wordIndex, bool wrapAll);
779  void balanceBreakPosAndHeight (int wordIndex, int firstIndex,
780  int *searchUntil, bool tempNewLine,
781  int penaltyIndex, bool borderIsCalculated,
782  bool *thereWillBeMoreSpace, bool wrapAll,
783  int *diffWords, int *wordIndexEnd,
784  int *lastFloatPos, bool regardBorder,
785  int *height, int *breakPos);
786  int searchBreakPos (int wordIndex, int firstIndex, int *searchUntil,
787  bool tempNewLine, int penaltyIndex,
788  bool thereWillBeMoreSpace, bool wrapAll,
789  int *diffWords, int *wordIndexEnd,
790  int *addIndex1 = NULL);
791  int searchMinBap (int firstWord, int lastWordm, int penaltyIndex,
792  bool thereWillBeMoreSpace, bool correctAtEnd);
793  int considerHyphenation (int firstIndex, int breakPos);
794  bool isHyphenationCandidate (Word *word);
795  int calcLinePartHeight (int firstWord, int lastWord);
796 
797  void handleWordExtremes (int wordIndex);
798  void correctLastWordExtremes ();
799 
800  static int getSpaceShrinkability(struct Word *word);
801  static int getSpaceStretchability(struct Word *word);
802  int getLineShrinkability(int lastWordIndex);
803  int getLineStretchability(int lastWordIndex);
804  int hyphenateWord (int wordIndex, int *addIndex1 = NULL);
805  void moveWordIndices (int wordIndex, int num, int *addIndex1 = NULL);
806  void accumulateWordForLine (int lineIndex, int wordIndex);
807  void accumulateWordData (int wordIndex);
808  int calcLineBreakWidth (int lineIndex);
809  void initLine1Offset (int wordIndex);
810  void alignLine (int lineIndex);
811  void calcTextOffset (int lineIndex, int totalWidth);
812 
813  void drawLevel (core::View *view, core::Rectangle *area, int level,
814  core::DrawingContext *context);
815 
816  Widget *getWidgetAtPointLevel (int x, int y, int level,
818 
819  void sizeRequestImpl (core::Requisition *requisition, int numPos,
820  Widget **references, int *x, int *y);
823 
825 
828 
829  void notifySetAsTopLevel ();
830  void notifySetParent ();
831 
833 
834  void calcExtraSpaceImpl (int numPos, Widget **references, int *x, int *y);
835 
836  int getAvailWidthOfChild (core::Widget *child, bool forceValue);
837  int getAvailHeightOfChild (core::Widget *child, bool forceValue);
838 
841  bool usesAvailWidth ();
842  void resizeDrawImpl ();
843 
844  void markSizeChange (int ref);
845  void markExtremesChange (int ref);
846 
847  bool isBlockLevel ();
848 
849  bool buttonPressImpl (core::EventButton *event);
850  bool buttonReleaseImpl (core::EventButton *event);
851  bool motionNotifyImpl (core::EventMotion *event);
852  void enterNotifyImpl (core::EventCrossing *event);
853  void leaveNotifyImpl (core::EventCrossing *event);
854 
855  void removeChild (Widget *child);
856 
857  void addText0 (const char *text, size_t len, short flags,
859  void calcTextSizes (const char *text, size_t textLen,
861  int numBreaks, int *breakPos,
862  core::Requisition *wordSize);
863 
864  int getGeneratorRest (int oofmIndex);
865 
866 public:
867  static int CLASS_ID;
868 
869  static void setPenaltyHyphen (int penaltyHyphen);
870  static void setPenaltyHyphen2 (int penaltyHyphen2);
871  static void setPenaltyEmDashLeft (int penaltyLeftEmDash);
872  static void setPenaltyEmDashRight (int penaltyRightEmDash);
873  static void setPenaltyEmDashRight2 (int penaltyRightEmDash2);
874  static void setStretchabilityFactor (int stretchabilityFactor);
875 
876  static inline bool mustAddBreaks (core::style::Style *style)
877  { return !testStyleOutOfFlow (style) ||
879 
880  Textblock (bool limitTextWidth);
881  ~Textblock ();
882 
883  core::Iterator *iterator (core::Content::Type mask, bool atEnd);
884 
885  void flush ();
886 
887  void addText (const char *text, size_t len, core::style::Style *style);
888  inline void addText (const char *text, core::style::Style *style)
889  { addText (text, strlen(text), style); }
891  bool addAnchor (const char *name, core::style::Style *style);
893  void addBreakOption (core::style::Style *style, bool forceBreak);
894  void addParbreak (int space, core::style::Style *style);
896 
898  void changeLinkColor (int link, int newColor);
899  void changeWordStyle (int from, int to, core::style::Style *style,
900  bool includeFirstSpace, bool includeLastSpace);
901 
902  void updateReference (int ref);
903  void widgetRefSizeChanged (int externalIndex);
904  void clearPositionChanged ();
905  void oofSizeChanged (bool extremesChanged);
906  int getGeneratorX (int oofmIndex);
907  int getGeneratorY (int oofmIndex);
908  int getGeneratorWidth (int callerX, int callerWidth);
909  int getMaxGeneratorWidth ();
910  bool usesMaxGeneratorWidth ();
911  bool isPossibleOOFContainer (int oofmIndex);
912  bool isPossibleOOFContainerParent (int oofmIndex);
913 };
914 
915 #define DBG_SET_WORD_PENALTY(n, i, is) \
916  D_STMT_START { \
917  if (words->getRef(n)->badnessAndPenalty.getPenalty (i) == INT_MIN) \
918  DBG_OBJ_ARRATTRSET_SYM ("words", n, "penalty." is, "-inf"); \
919  else if (words->getRef(n)->badnessAndPenalty.getPenalty (i) == INT_MAX) \
920  DBG_OBJ_ARRATTRSET_SYM ("words", n, "penalty." is, "inf"); \
921  else \
922  DBG_OBJ_ARRATTRSET_NUM ("words", n, "penalty." is, \
923  words->getRef(n)->badnessAndPenalty \
924  .getPenalty (i)); \
925  } D_STMT_END
926 
927 #ifdef DBG_RTFL
928 #define DBG_OBJ_ARRATTRSET_WREF(var, ind, attr, wref) \
929  RTFL_OBJ_PRINT ("set", "p:s.d.s:p (p, d)", this, var, ind, attr, wref, \
930  wref->widget, wref->parentRef)
931 #else
932 #define DBG_OBJ_ARRATTRSET_WREF(var, ind, attr, wref) STMT_NOP
933 #endif
934 
935 #define DBG_SET_WORD(n) \
936  D_STMT_START { \
937  switch (words->getRef(n)->content.type) { \
938  case ::dw::core::Content::TEXT: \
939  DBG_OBJ_ARRATTRSET_SYM ("words", n, "type", "TEXT"); \
940  DBG_OBJ_ARRATTRSET_STR ("words", n, \
941  "text/widget/widgetReference/breakSpace", \
942  words->getRef(n)->content.text); \
943  break; \
944  case ::dw::core::Content::WIDGET_IN_FLOW: \
945  DBG_OBJ_ARRATTRSET_SYM ("words", n, "type", "WIDGET_IN_FLOW"); \
946  DBG_OBJ_ARRATTRSET_PTR ("words", n, \
947  "text/widget/widgetReference/breakSpace", \
948  words->getRef(n)->content.widget); \
949  break; \
950  case ::dw::core::Content::WIDGET_OOF_REF: \
951  DBG_OBJ_ARRATTRSET_SYM ("words", n, "type", "WIDGET_OOF_REF"); \
952  DBG_OBJ_ARRATTRSET_WREF ("words", n, \
953  "text/widget/widgetReference/breakSpace", \
954  words->getRef(n)->content.widgetReference); \
955  break; \
956  case ::dw::core::Content::BREAK: \
957  DBG_OBJ_ARRATTRSET_SYM ("words", n, "type", "BREAK"); \
958  DBG_OBJ_ARRATTRSET_NUM ("words", n, \
959  "text/widget/widgetReference/breakSpace", \
960  words->getRef(n)->content.breakSpace); \
961  break; \
962  default: \
963  DBG_OBJ_ARRATTRSET_SYM ("words", n, "type", "???"); \
964  DBG_OBJ_ARRATTRSET_SYM ("words", n, \
965  "text/widget/widgetReference/breakSpace", \
966  "???"); \
967  } \
968  DBG_SET_WORD_PENALTY (n, 0, "0"); \
969  DBG_SET_WORD_PENALTY (n, 1, "1"); \
970  } D_STMT_END
971 
972 #define DBG_SET_WORD_SIZE(n) \
973  D_STMT_START { \
974  DBG_OBJ_ARRATTRSET_NUM ("words", n, "size.width", \
975  words->getRef(n)->size.width); \
976  DBG_OBJ_ARRATTRSET_NUM ("words", n, "size.ascent", \
977  words->getRef(n)->size.ascent); \
978  DBG_OBJ_ARRATTRSET_NUM ("words", n, "size.descent", \
979  words->getRef(n)->size.descent); \
980  } D_STMT_END
981 
982 #define DBG_MSG_WORD(aspect, prio, prefix, n, suffix) \
983  D_STMT_START { \
984  if ((n) < 0 || (n) >= words->size ()) \
985  DBG_OBJ_MSG (aspect, prio, prefix "undefined (wrong index)" suffix); \
986  else { \
987  switch (words->getRef(n)->content.type) { \
988  case ::dw::core::Content::TEXT: \
989  DBG_OBJ_MSGF (aspect, prio, prefix "TEXT / \"%s\"" suffix, \
990  words->getRef(n)->content.text); \
991  break; \
992  case ::dw::core::Content::WIDGET_IN_FLOW: \
993  DBG_OBJ_MSGF (aspect, prio, prefix "WIDGET_IN_FLOW / %p" suffix, \
994  words->getRef(n)->content.widget); \
995  break; \
996  case ::dw::core::Content::WIDGET_OOF_REF: \
997  DBG_OBJ_MSGF (aspect, prio, \
998  prefix "WIDGET_OOF_REF / %p (%p, %d)" suffix,\
999  words->getRef(n)->content.widgetReference, \
1000  words->getRef(n)->content.widgetReference->widget, \
1001  words->getRef(n)->content.widgetReference \
1002  ->parentRef); \
1003  break; \
1004  case ::dw::core::Content::BREAK: \
1005  DBG_OBJ_MSGF (aspect, prio, prefix "BREAK / %d" suffix, \
1006  words->getRef(n)->content.breakSpace); \
1007  break; \
1008  default: \
1009  DBG_OBJ_MSG (aspect, prio, prefix "??? / ???" suffix); \
1010  } \
1011  } \
1012  } D_STMT_END
1013 
1014 } // namespace dw
1015 
1016 #endif // __DW_TEXTBLOCK_HH__
T * getRef(int i) const
Return the reference of one element.
Definition: misc.hh:190
WordImgRenderer * wordImgRenderer
Definition: textblock.hh:499
Definition: textblock.hh:368
bool usesMaxGeneratorWidth()
Definition: textblock.cc:3116
bool buttonReleaseImpl(core::EventButton *event)
Definition: textblock.cc:948
int totalSpaceStretchability
Definition: textblock.hh:488
int top
Definition: textblock.hh:374
Definition: textblock.hh:433
short flags
Definition: textblock.hh:475
int maxParMaxIntrinsic
Definition: textblock.hh:365
int lineYOffsetWidget(int lineIndex, core::Allocation *allocation)
Definition: textblock.hh:737
Extremes extremes
Analogue to dw::core::Widget::requisition.
Definition: widget.hh:146
static int getSpaceStretchability(struct Word *word)
Definition: textblock_linebreaking.cc:2247
int wrapWordOofRef(int wordIndex, bool wrapAll)
Definition: textblock_linebreaking.cc:859
void addText0(const char *text, size_t len, short flags, core::style::Style *style, core::Requisition *size)
Definition: textblock.cc:2352
A Widget for rendering text blocks, i.e. paragraphs or sequences of paragraphs.
Definition: textblock.hh:205
Definition: textblock.hh:509
int lastWord
Definition: textblock.hh:337
int wrapWordInFlow(int wordIndex, bool wrapAll)
Definition: textblock_linebreaking.cc:585
core::style::Style * getStyle()
Return the style this background image is part of.
Definition: textblock.cc:117
static bool mustAddBreaks(core::style::Style *style)
Definition: textblock.hh:876
bool isPossibleOOFContainer(int oofmIndex)
Definition: textblock.cc:3134
int getLineShrinkability(int lastWordIndex)
Definition: textblock_linebreaking.cc:2257
Widget * sizeReferences[NUM_OOFM]
Definition: textblock.hh:620
style::Style * style
Definition: widget.hh:130
int findLineOfWord(int wordIndex)
Find the line of word wordIndex.
Definition: textblock.cc:1635
core::style::Style * style
Definition: textblock.hh:493
lout::misc::SimpleVector< Anchor > * anchors
Definition: textblock.hh:612
bool buttonPressImpl(core::EventButton *event)
Definition: textblock.cc:943
int numSizeRequestReferences()
See Sizes of Dillo Widgets (or Size requisitions depending on positions).
Definition: textblock.cc:425
void setSpaceImgRenderer(int wordNo)
Definition: textblock.cc:1860
Set at the top when getting the widget at the point.
Definition: types.hh:312
Definition: textblock.hh:438
struct dw::Textblock::@27 hlEnd[core::HIGHLIGHT_NUM_LAYERS]
int lineYOffsetWidget(Line *line, core::Allocation *allocation)
Definition: textblock.hh:712
int nonTemporaryLines
Definition: textblock.hh:610
A class for fast concatenation of a large number of strings.
Definition: misc.hh:565
int numContentsInFlow()
Definition: textblock_iterator.cc:273
core::style::Style * getStyle()
Return the style this background image is part of.
Definition: textblock.cc:97
Widget * getExtremesReference(int index)
See Sizes of Dillo Widgets (or Size requisitions depending on positions).
Definition: textblock.cc:549
Widget * sizeRequestReference(int index)
See Sizes of Dillo Widgets (or Size requisitions depending on positions).
Definition: textblock.cc:430
~WordImgRenderer()
Definition: textblock.cc:57
Suitable for widgets and parts of widgets.
Definition: style.hh:854
void notifySetAsTopLevel()
This method is called after a widget has been set as the top of a widget tree.
Definition: textblock.cc:554
bool calcSizeOfWidgetInFlow(int wordIndex, Widget *widget, core::Requisition *size)
Definition: textblock.cc:2274
int wordNo
Definition: textblock.hh:308
int wrapRefParagraphs
Definition: textblock.hh:583
Requisition requisition
Size_request() stores the result of the last call of size_request_impl().
Definition: widget.hh:140
void calcExtraSpaceImpl(int numPos, Widget **references, int *x, int *y)
Definition: textblock.cc:750
Shading
Definition: style.hh:767
dw::core::Shape implemtation for simple rectangles.
Definition: types.hh:69
void changeLinkColor(int link, int newColor)
Definition: textblock.cc:2908
void sizeRequestImpl(core::Requisition *requisition, int numPos, Widget **references, int *x, int *y)
Definition: textblock.cc:305
int newLineAscent
Definition: textblock.hh:606
BadnessAndPenalty badnessAndPenalty
Definition: textblock.hh:490
Type
Definition: types.hh:199
void setWordImgRenderer(int wordNo)
Definition: textblock.cc:1836
int newLineRightBorder
Definition: textblock.hh:596
Definition: textblock.hh:425
void drawWord(Line *line, int wordIndex1, int wordIndex2, core::View *view, core::Rectangle *area, int xWidget, int yWidgetBase)
Definition: textblock.cc:1281
int rightOffset
Definition: textblock.hh:424
int contentAscent
Definition: textblock.hh:391
core::Iterator * iterator(core::Content::Type mask, bool atEnd)
Return an iterator for this widget.
Definition: textblock.cc:1176
bool newLineHasFloatRight
Definition: textblock.hh:595
lout::object::Object * clone()
Definition: textblock_iterator.cc:51
int newLineDescent
Definition: textblock.hh:606
int lineYOffsetWidget(int lineIndex)
Definition: textblock.hh:732
bool unbreakableForMinWidth
Definition: textblock.hh:290
Definition: textblock.hh:222
int wordIndex
Definition: textblock.hh:506
int hyphenateWord(int wordIndex, int *addIndex1=NULL)
Definition: textblock_linebreaking.cc:1405
void correctLastWordExtremes()
Definition: textblock_linebreaking.cc:1389
int yOffsetOfLineToBeCreated(int *lastMargin=NULL)
Definition: textblock.cc:3191
void changeWordStyle(int from, int to, core::style::Style *style, bool includeFirstSpace, bool includeLastSpace)
Definition: textblock.cc:2959
This is the base class for many other classes, which defines very common virtual methods.
Definition: object.hh:24
RegardingBorder * getWidgetRegardingBorderForLine(Line *line)
Definition: textblock.cc:3144
bool affectsSizeChangeContainerChild(Widget *child)
Definition: textblock.cc:834
int hoverLink
Definition: textblock.hh:617
int leftInnerPadding
Definition: textblock.hh:534
int numGetExtremesReferences()
See Sizes of Dillo Widgets (or Size requisitions depending on positions).
Definition: textblock.cc:544
int lineYOffsetCanvas(Line *line)
Definition: textblock.hh:727
int lastWord
Definition: textblock.hh:371
int penaltyIndexRight
Definition: textblock.hh:291
static TextblockIterator * createWordIndexIterator(Textblock *textblock, core::Content::Type mask, int wordIndex)
Definition: textblock_iterator.cc:41
Represents a button press or release event.
Definition: events.hh:57
lout::misc::NotSoSimpleVector< Word > * words
Definition: textblock.hh:611
int calcPenaltyIndexForNewLine()
Definition: textblock.hh:747
int index
Definition: textblock.hh:614
int borderDescent
Definition: textblock.hh:387
Represents a enter or leave notify event.
Definition: events.hh:74
Flags flags
Definition: widget.hh:132
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)
Definition: textblock.cc:1214
int lineBreakWidth
Definition: textblock.hh:581
int findLineIndexWhenNotAllocated(int y)
Definition: textblock.cc:1576
int maxDescent
Definition: textblock.hh:487
void enterNotifyImpl(core::EventCrossing *event)
Definition: textblock.cc:1000
int size() const
Return the number of elements put into this vector.
Definition: misc.hh:141
void fillSpace(int wordNo, core::style::Style *style)
Definition: textblock.cc:2559
bool dataSet
Definition: textblock.hh:309
int newLineLeftFloatHeight
Definition: textblock.hh:600
int maxLineWidth
Definition: textblock.hh:413
void drawLine(Line *line, core::View *view, core::Rectangle *area, core::DrawingContext *context)
Definition: textblock.cc:1488
int getGeneratorWidth(int callerX, int callerWidth)
Definition: textblock.cc:3089
void markSizeChange(int ref)
See Sizes of Dillo Widgets.
Definition: textblock.cc:877
static int getSpaceShrinkability(struct Word *word)
Definition: textblock_linebreaking.cc:2239
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)
Definition: textblock.cc:1334
Hold arguments passed to dw::core::Widget::sizeRequest and dw::core::Widget::getExtremes, as described in Size requisitions depending on positions.
Definition: tools.hh:18
int searchMinBap(int firstWord, int lastWordm, int penaltyIndex, bool thereWillBeMoreSpace, bool correctAtEnd)
Definition: textblock_linebreaking.cc:1115
core::Requisition size
Definition: textblock.hh:464
void highlight(int start, int end, core::HighlightLayer layer)
Definition: textblock_iterator.cc:59
bool isHyphenationCandidate(Word *word)
Definition: textblock_linebreaking.cc:1222
const char * s
Definition: textblock.hh:289
void removeTemporaryLines()
Definition: textblock_linebreaking.cc:2218
void queueDrawRange(int index1, int index2)
Definition: textblock.cc:2964
int badnessValue(int infLevel)
Definition: textblock_linebreaking.cc:37
int lastOofRefPositionedBeforeThisLine
Definition: textblock.hh:422
Iterators are used to iterate through the contents of a widget.
Definition: iterator.hh:19
int leftOffset
Definition: textblock.hh:424
bool limitTextWidth
Definition: textblock.hh:573
static int stretchabilityFactor
Definition: textblock.hh:571
void accumulateWordForLine(int lineIndex, int wordIndex)
Definition: textblock_linebreaking.cc:1558
char * name
Definition: textblock.hh:505
TextblockIterator(Textblock *textblock, core::Content::Type mask, bool atEnd)
Definition: textblock_iterator.cc:33
WordImgRenderer(Textblock *textblock, int wordNo)
Definition: textblock.cc:47
Definition: textblock.hh:283
void getRefArea(int *xRef, int *yRef, int *widthRef, int *heightRef)
Return the "reference area".
Definition: textblock.cc:90
bool ignoreLine1OffsetSometimes
Definition: textblock.hh:556
bool extremesChanged()
Definition: widget.hh:440
int lineYOffsetWidget(Line *line)
Definition: textblock.hh:717
void getBgArea(int *x, int *y, int *width, int *height)
Return the area covered by the background image.
Definition: textblock.cc:79
void initNewLine()
Definition: textblock_linebreaking.cc:2036
core::style::Style * spaceStyle
Definition: textblock.hh:494
int parAdjustmentWidth
Definition: textblock.hh:353
int wrapRefLinesFCY
Definition: textblock.hh:587
bool addAnchor(const char *name, core::style::Style *style)
Definition: textblock.cc:2479
static void setPenaltyHyphen2(int penaltyHyphen2)
Definition: textblock.cc:179
Textblock * textblock
Definition: textblock.hh:307
Definition: textblock.hh:443
Definition: textblock.hh:455
void oofSizeChanged(bool extremesChanged)
Definition: textblock.cc:3014
void justifyLine(Line *line, int diff)
Definition: textblock_linebreaking.cc:249
int totalHeight(int marginNextLine)
Returns the difference between two vertical lines positions: height of this line plus space below thi...
Definition: textblock.hh:402
void handleWordExtremes(int wordIndex)
Definition: textblock_linebreaking.cc:1248
Definition: oofawarewidget.hh:80
void clearPositionChanged()
Definition: textblock.cc:3005
bool isBreakAllowed(core::style::Style *style)
Definition: textblock.cc:2637
int firstWord
Definition: textblock.hh:370
bool motionNotifyImpl(core::EventMotion *event)
Definition: textblock.cc:958
void intoStringBuffer(lout::misc::StringBuffer *sb)
Definition: textblock_linebreaking.cc:195
bool usesAvailWidth()
Must be implemengted by a method returning true, when getAvailWidth() is called.
Definition: textblock.cc:852
lout::misc::SimpleVector< Paragraph > * paragraphs
Definition: textblock.hh:609
Definition: style.hh:613
void getContentInFlow(int index, core::Content *content)
Definition: textblock_iterator.cc:278
Definition: textblock.hh:285
int textOffset
Definition: textblock.hh:394
void resizeDrawImpl()
Called after sizeAllocateImpl() to redraw necessary areas. By default the whole widget is redrawn...
Definition: textblock.cc:857
void getExtremesSimpl(core::Extremes *extremes)
Simple variant, to be implemented by widgets with extremes not depending on positions.
Definition: textblock.cc:470
bool mustBorderBeRegarded(Line *line)
Definition: textblock.hh:696
lout::misc::SimpleVector< Line > * lines
Definition: textblock.hh:608
Definition: types.hh:172
Represents the allocation, i.e. actual position and size of a dw::core::Widget.
Definition: types.hh:163
void addBreakOption(core::style::Style *style, bool forceBreak)
Definition: textblock.cc:2543
void addText(const char *text, core::style::Style *style)
Definition: textblock.hh:888
bool findSizeRequestReference(Widget *reference, int *xRef=NULL, int *yRef=NULL)
Definition: textblock.cc:2336
void calcBorders(int lastOofRef, int height)
Definition: textblock_linebreaking.cc:2052
bool sendSelectionEvent(core::SelectionState::EventType eventType, core::MousePositionEvent *event)
Send event to selection.
Definition: textblock.cc:1024
Implementation used for words.
Definition: textblock.hh:303
void setSinglePenalty(int index, int penalty)
Definition: textblock_linebreaking.cc:137
void moveWordIndices(int wordIndex, int num, int *addIndex1=NULL)
Definition: textblock_linebreaking.cc:1512
int getAvailHeightOfChild(core::Widget *child, bool forceValue)
Definition: textblock.cc:809
void draw(int x, int y, int width, int height)
Draw (or queue for drawing) an area, which is given in canvas coordinates.
Definition: textblock.cc:102
int line1Offset
Definition: textblock.hh:536
void addWidget(core::Widget *widget, core::style::Style *style)
Definition: textblock.cc:2397
int maxParAdjustmentWidth
Definition: textblock.hh:362
void accumulateWordData(int wordIndex)
Definition: textblock_linebreaking.cc:1620
void initLine1Offset(int wordIndex)
Definition: textblock_linebreaking.cc:1745
Line * addLine(int firstWord, int lastWord, int newLastOofPos, bool temporary, int minHeight)
Definition: textblock_linebreaking.cc:306
int findLineIndexWhenAllocated(int y)
Definition: textblock.cc:1590
int marginDescent
Definition: textblock.hh:380
void unhighlight(int direction, core::HighlightLayer layer)
Definition: textblock_iterator.cc:122
virtual int wordWrap(int wordIndex, bool wrapAll)
Definition: textblock_linebreaking.cc:557
Textblock(bool limitTextWidth)
Definition: textblock.cc:205
OOFAwareWidget * oofContainer[NUM_OOFM]
Definition: oofawarewidget.hh:153
bool lineTooTight()
Definition: textblock_linebreaking.cc:164
Definition: textblock.hh:287
The base class of all dillo widgets.
Definition: widget.hh:23
void calcTextSizes(const char *text, size_t textLen, core::style::Style *style, int numBreaks, int *breakPos, core::Requisition *wordSize)
Definition: textblock.cc:2236
SpaceImgRenderer(Textblock *textblock, int wordNo)
Definition: textblock.hh:327
int lineYOffsetCanvas(Line *line, core::Allocation *allocation)
Definition: textblock.hh:722
Base class for all mouse events related to a specific position.
Definition: events.hh:48
void fillParagraphs()
Definition: textblock_linebreaking.cc:1979
Set at the top when drawing.
Definition: types.hh:294
int newLineLeftBorder
Definition: textblock.hh:596
Definition: textblock.hh:425
T max(T a, T b)
Definition: misc.hh:20
Simple (simpler than container::untyped::Vector and container::typed::Vector) template based vector...
Definition: misc.hh:93
bool lineLoose()
Definition: textblock_linebreaking.cc:151
void getWordExtremes(Word *word, core::Extremes *extremes)
Definition: textblock.cc:460
void widgetRefSizeChanged(int externalIndex)
Definition: textblock.cc:2998
Definition: textblock.hh:283
Definition: textblock.hh:324
Definition: types.hh:197
int totalWidth
Definition: textblock.hh:479
int maxParMax
Definition: textblock.hh:363
void addSpace(core::style::Style *style)
Definition: textblock.cc:2522
int marginAscent
Definition: textblock.hh:377
int lineNo
Definition: textblock.hh:308
Definition: textblock.hh:252
void leaveNotifyImpl(core::EventCrossing *event)
Definition: textblock.cc:1007
int wrapRefLinesFCX
Definition: textblock.hh:587
int parMin
Definition: textblock.hh:349
int firstWord
Definition: textblock.hh:336
Definition: textblock.hh:425
Definition: types.hh:179
Base class (rather a tag interface) for those widgets regarding borders defined by floats...
Definition: regardingborder.hh:13
Definition: textblock.hh:435
bool mustBorderBeRegarded(int lineNo)
Definition: textblock.hh:701
Definition: textblock.hh:334
Definition: textblock.hh:428
int getGeneratorX(int oofmIndex)
Definition: textblock.cc:3028
void removeWordImgRenderer(int wordNo)
Definition: textblock.cc:1824
static const char * hyphenDrawChar
Definition: textblock.hh:296
Allocation allocation
The current allocation: size and position, always relative to the canvas.
Definition: widget.hh:183
int penaltyValue(int index, int infLevel)
Definition: textblock_linebreaking.cc:58
void addParbreak(int space, core::style::Style *style)
Definition: textblock.cc:2660
int ascent
Definition: types.hh:168
int redrawY
Definition: textblock.hh:575
int calcVerticalBorder(int widgetPadding, int widgetBorder, int widgetMargin, int lineBorderTotal, int lineMarginTotal)
Definition: textblock.cc:435
int badness
Definition: textblock.hh:228
void containerSizeChangedForChildren()
Definition: textblock.cc:819
int parMaxIntrinsic
Definition: textblock.hh:357
static void setStretchabilityFactor(int stretchabilityFactor)
Definition: textblock.cc:200
int compareTo(int penaltyIndex, BadnessAndPenalty *other)
Definition: textblock_linebreaking.cc:180
HighlightLayer
Definition: types.hh:42
void showMissingLines()
Definition: textblock_linebreaking.cc:2161
static int CLASS_ID
Definition: textblock.hh:867
EventType
Definition: selection.hh:220
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)
Definition: textblock_linebreaking.cc:906
void decorateText(core::View *view, core::style::Style *style, core::style::Color::Shading shading, int x, int yBase, int width)
Definition: textblock.cc:1184
int getMaxGeneratorWidth()
Definition: textblock.cc:3109
void flush()
Definition: textblock.cc:2891
void rewrap()
Definition: textblock_linebreaking.cc:1905
SpaceImgRenderer * spaceImgRenderer
Definition: textblock.hh:500
core::Content content
Definition: textblock.hh:476
void initWord(int wordNo)
Definition: textblock.cc:1798
bool isPossibleOOFContainerParent(int oofmIndex)
Definition: textblock.cc:3139
void processWord(int wordIndex)
Definition: textblock_linebreaking.cc:497
int ratio
Definition: textblock.hh:227
void sizeAllocateImpl(core::Allocation *allocation)
See Sizes of Dillo Widgets.
Definition: textblock.cc:585
void markExtremesChange(int ref)
See Sizes of Dillo Widgets.
Definition: textblock.cc:911
int borderAscent
Definition: textblock.hh:383
Word * addWord(int width, int ascent, int descent, short flags, core::style::Style *style)
Definition: textblock.cc:1774
int maxParMinIntrinsic
Definition: textblock.hh:361
T * getRef(int i) const
Return the reference of one element.
Definition: misc.hh:472
~Textblock()
Definition: textblock.cc:274
bool findSizeRequestReference(int oofmIndex, int *xRef=NULL, int *yRef=NULL)
Definition: textblock.hh:688
int calcLineBreakWidth(int lineIndex)
Definition: textblock_linebreaking.cc:1713
void calcTextOffset(int lineIndex, int totalWidth)
Definition: textblock_linebreaking.cc:1854
int penalty[2]
Definition: textblock.hh:228
enum dw::Textblock::BadnessAndPenalty::@28 badnessState
bool isBlockLevel()
Definition: textblock.cc:938
static void setPenaltyEmDashRight2(int penaltyRightEmDash2)
Definition: textblock.cc:195
void setPenalties(int penalty1, int penalty2)
Definition: textblock_linebreaking.cc:130
static int penalties[PENALTY_NUM][2]
Definition: textblock.hh:566
short effSpace
Definition: textblock.hh:467
Dw is in this namespace, or sub namespaces of this one.
Definition: alignedtablecell.cc:28
bool mustQueueResize
Definition: textblock.hh:558
int maxParMin
Definition: textblock.hh:359
int textWidth(const char *text, int start, int len, core::style::Style *style, bool isStart, bool isEnd)
Definition: textblock.cc:1905
core::SizeParams sizeRequestParams
Definition: textblock.hh:578
An interface to encapsulate platform dependent drawing.
Definition: view.hh:16
bool lineCanBeBroken(int penaltyIndex)
Definition: textblock_linebreaking.cc:175
static void setPenaltyEmDashLeft(int penaltyLeftEmDash)
Definition: textblock.cc:184
int getLineStretchability(int lastWordIndex)
Definition: textblock_linebreaking.cc:2262
int lineYOffsetCanvas(int lineIndex)
Definition: textblock.hh:742
Definition: textblock.hh:219
int nChar
Definition: textblock.hh:614
Widget()
Definition: widget.cc:67
T * getLastRef() const
Return the reference of the last element (convenience method).
Definition: misc.hh:225
int getAvailWidthOfChild(core::Widget *child, bool forceValue)
Definition: textblock.cc:771
struct dw::Textblock::@27 hlStart[core::HIGHLIGHT_NUM_LAYERS]
Definition: textblock.hh:218
Definition: types.hh:46
void getBgArea(int *x, int *y, int *width, int *height)
Return the area covered by the background image.
Definition: textblock.cc:109
Container similar to lout::misc::SimpleVector, but some cases of insertion optimized (used for hyphen...
Definition: misc.hh:310
int wrapRefLines
Definition: textblock.hh:583
void getAllocation(int start, int end, core::Allocation *allocation)
Definition: textblock_iterator.cc:186
int getPenalty(int i)
Definition: textblock.hh:271
void removeSpaceImgRenderer(int wordNo)
Definition: textblock.cc:1848
int maxAscent
Definition: textblock.hh:487
void fillWord(int wordNo, int width, int ascent, int descent, short flags, core::style::Style *style)
Definition: textblock.cc:1872
Definition: textblock.hh:451
Definition: textblock.hh:460
bool isBreakAllowedInWord(Word *word)
Definition: textblock.hh:677
static void setPenaltyEmDashRight(int penaltyRightEmDash)
Definition: textblock.cc:190
Word * findWord(int x, int y, bool *inSpace)
Find the index of the word, or -1.
Definition: textblock.cc:1685
short origSpace
Definition: textblock.hh:466
void calcTextSize(const char *text, size_t len, core::style::Style *style, core::Requisition *size, bool isStart, bool isEnd)
Definition: textblock.cc:1967
Represents a mouse motion event.
Definition: events.hh:67
bool lineTight()
Definition: textblock_linebreaking.cc:158
void addText(const char *text, size_t len, core::style::Style *style)
Definition: textblock.cc:2022
int findLineIndex(int y)
Definition: textblock.cc:1570
void removeChild(Widget *child)
Definition: textblock.cc:1171
void cleanupWord(int wordNo)
Definition: textblock.cc:1807
Widget * getWidgetAtPointLevel(int x, int y, int level, core::GettingWidgetAtPointContext *context)
Definition: textblock.cc:2805
static bool testStyleRelativelyPositioned(core::style::Style *style)
Definition: oofawarewidget.hh:212
void notifySetParent()
This method is called after a widget has been added to a parent.
Definition: textblock.cc:562
void handOverBreak(core::style::Style *style)
Definition: textblock.cc:2870
short hyphenWidth
Definition: textblock.hh:469
int newLineRightFloatHeight
Definition: textblock.hh:600
int findParagraphOfWord(int wordIndex)
Find the paragraph of word wordIndex.
Definition: textblock.cc:1659
bool readyToDraw()
If this method returns false, nothing is done at all.
Definition: textblock.cc:69
void breakAdded()
Definition: textblock.cc:2781
int breakSpace
Definition: textblock.hh:393
int contentDescent
Definition: textblock.hh:392
int parMinIntrinsic
Definition: textblock.hh:352
int getGeneratorY(int oofmIndex)
Definition: textblock.cc:3045
void setPenalty(int penalty)
Definition: textblock.hh:267
int totalSpaceShrinkability
Definition: textblock.hh:489
int searchBreakPos(int wordIndex, int firstIndex, int *searchUntil, bool tempNewLine, int penaltyIndex, bool thereWillBeMoreSpace, bool wrapAll, int *diffWords, int *wordIndexEnd, int *addIndex1=NULL)
Definition: textblock_linebreaking.cc:1003
enum dw::Textblock::Line::@30 alignment
bool lineMustBeBroken(int penaltyIndex)
Definition: textblock_linebreaking.cc:170
void alignLine(int lineIndex)
Definition: textblock_linebreaking.cc:1778
int considerHyphenation(int firstIndex, int breakPos)
Definition: textblock_linebreaking.cc:1187
void drawLevel(core::View *view, core::Rectangle *area, int level, core::DrawingContext *context)
Definition: textblock.cc:1728
void drawSpace(int wordIndex, core::View *view, core::Rectangle *area, int xWidget, int yWidgetBase)
Definition: textblock.cc:1438
int yOffsetOfLineCreated(Line *line)
Definition: textblock.cc:3239
void setBreakOption(Word *word, core::style::Style *style, int breakPenalty1, int breakPenalty2, bool forceBreak)
Definition: textblock.cc:2618
bool hasListitemValue
Definition: textblock.hh:532
int getGeneratorRest(int oofmIndex)
Definition: textblock.cc:3062
static void setPenaltyHyphen(int penaltyHyphen)
Definition: textblock.cc:174
int numSizeReferences
Definition: textblock.hh:619
static DivChar divChars[NUM_DIV_CHARS]
Definition: textblock.hh:294
int calcLinePartHeight(int firstWord, int lastWord)
Definition: textblock_linebreaking.cc:1232
int parMax
Definition: textblock.hh:354
int line1OffsetEff
Definition: textblock.hh:539
bool newLineHasFloatLeft
Definition: textblock.hh:595
Definition: textblock.hh:284
void setData(int xWordWidget, int lineNo)
Definition: textblock.cc:62
static bool testStyleOutOfFlow(core::style::Style *style)
Definition: oofawarewidget.hh:220
void calcBadness(int totalWidth, int idealWidth, int totalStretchability, int totalShrinkability)
Definition: textblock_linebreaking.cc:68
Definition: textblock.hh:283
int lastWordDrawn
Definition: textblock.hh:576
int xWordWidget
Definition: textblock.hh:308
void addLinebreak(core::style::Style *style)
Definition: textblock.cc:2748
int y
Definition: types.hh:166
void updateReference(int ref)
Definition: textblock.cc:2993
Definition: textblock.hh:503