Home | History | Annotate | Download | only in layout
      1 /*
      2  *******************************************************************************
      3  *
      4  *   Copyright (C) 1999-2007, International Business Machines
      5  *   Corporation and others.  All Rights Reserved.
      6  *
      7  *******************************************************************************
      8  *   file name:  Paragraph.h
      9  *
     10  *   created on: 09/06/2000
     11  *   created by: Eric R. Mader
     12  */
     13 #ifndef __PARAGRAPH_H
     14 #define __PARAGRAPH_H
     15 
     16 #include "unicode/utypes.h"
     17 #include "unicode/ubidi.h"
     18 
     19 #include "layout/LEFontInstance.h"
     20 #include "layout/ParagraphLayout.h"
     21 
     22 #include "GUISupport.h"
     23 #include "RenderingSurface.h"
     24 
     25 U_NAMESPACE_USE
     26 
     27 #define MARGIN 10
     28 
     29 #if 0
     30 class LineInfo;
     31 #endif
     32 
     33 class Paragraph
     34 {
     35 public:
     36     Paragraph(const LEUnicode chars[], le_int32 charCount, const FontRuns *fontRuns, LEErrorCode &status);
     37 
     38     ~Paragraph();
     39 
     40     le_int32 getAscent();
     41     le_int32 getLineHeight();
     42     le_int32 getLineCount();
     43     void breakLines(le_int32 width, le_int32 height);
     44     void draw(RenderingSurface *surface, le_int32 firstLine, le_int32 lastLine);
     45 
     46     static Paragraph *paragraphFactory(const char *fileName, const LEFontInstance *font, GUISupport *guiSupport);
     47 
     48 private:
     49     void addLine(const ParagraphLayout::Line *line);
     50 
     51     ParagraphLayout **fParagraphLayout;
     52 
     53     le_int32          fParagraphCount;
     54     le_int32          fParagraphMax;
     55     le_int32          fParagraphGrow;
     56 
     57     le_int32          fLineCount;
     58     le_int32          fLinesMax;
     59     le_int32          fLinesGrow;
     60 
     61     const ParagraphLayout::Line **fLines;
     62           LEUnicode *fChars;
     63 
     64     le_int32         fLineHeight;
     65     le_int32         fAscent;
     66     le_int32         fWidth;
     67     le_int32         fHeight;
     68     UBiDiLevel       fParagraphLevel;
     69 };
     70 
     71 inline le_int32 Paragraph::getLineHeight()
     72 {
     73     return fLineHeight;
     74 }
     75 
     76 inline le_int32 Paragraph::getLineCount()
     77 {
     78     return fLineCount;
     79 }
     80 
     81 inline le_int32 Paragraph::getAscent()
     82 {
     83     return fAscent;
     84 }
     85 
     86 #endif
     87 
     88 
     89