diff options
author | Sebastian Geerken <devnull@localhost> | 2013-12-09 14:44:42 +0100 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2013-12-09 14:44:42 +0100 |
commit | 01f697091153846bdffc73b3150ba37c763301cc (patch) | |
tree | 84773dff07a8498e7cc62695d89a6ecb29378a82 /dw/textblock.hh | |
parent | ee66f4f97e38d11e68b9515b7043aa8ac6f63c74 (diff) | |
parent | 6c7572f8bd23064f96ba716e1ba8ba8a34847001 (diff) |
Merge (large!).
Diffstat (limited to 'dw/textblock.hh')
-rw-r--r-- | dw/textblock.hh | 52 |
1 files changed, 50 insertions, 2 deletions
diff --git a/dw/textblock.hh b/dw/textblock.hh index 3af933ce..b9255bb9 100644 --- a/dw/textblock.hh +++ b/dw/textblock.hh @@ -244,6 +244,44 @@ private: OutOfFlowMgr *outOfFlowMgr; protected: + /** + * \brief Implementation used for words. + */ + class WordImgRenderer: + public core::style::StyleImage::ExternalWidgetImgRenderer + { + protected: + Textblock *textblock; + int wordNo, xWordWidget, lineNo; + bool dataSet; + + public: + WordImgRenderer (Textblock *textblock, int wordNo); + ~WordImgRenderer (); + + void setData (int xWordWidget, int lineNo); + + bool readyToDraw (); + void getBgArea (int *x, int *y, int *width, int *height); + void getRefArea (int *xRef, int *yRef, int *widthRef, int *heightRef); + core::style::Style *getStyle (); + void draw (int x, int y, int width, int height); + + virtual void print (); + }; + + class SpaceImgRenderer: public WordImgRenderer + { + public: + inline SpaceImgRenderer (Textblock *textblock, int wordNo) : + WordImgRenderer (textblock, wordNo) { } + + void getBgArea (int *x, int *y, int *width, int *height); + core::style::Style *getStyle (); + + void print (); + }; + struct Paragraph { int firstWord; /* first word's index in word vector */ @@ -373,6 +411,11 @@ protected: core::style::Style *style; core::style::Style *spaceStyle; /* initially the same as of the word, later set by a_Dw_page_add_space */ + + // These two are used rarely, so there is perhaps a way to store + // them which is consuming less memory. + WordImgRenderer *wordImgRenderer; + SpaceImgRenderer *spaceImgRenderer; }; void printWordShort (Word *word); @@ -536,9 +579,14 @@ protected: Word *addWord (int width, int ascent, int descent, short flags, core::style::Style *style); - void fillWord (Word *word, int width, int ascent, int descent, + void initWord (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 (Word *word, 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 isBreakAllowed (Word *word); |