• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files

fp_Run.h

Go to the documentation of this file.
00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */
00002 
00003 /* AbiWord
00004  * Copyright (C) 1998,1999 AbiSource, Inc.
00005  * Copyright (c) 2001,2002 Tomas Frydrych
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00020  * 02111-1307, USA.
00021  */
00022 
00023 
00024 
00025 #ifndef FP_RUN_H
00026 #define FP_RUN_H
00027 
00028 #ifdef FMT_TEST
00029 #include <stdio.h>
00030 #endif
00031 
00032 #include "ut_types.h"
00033 #include "ut_misc.h"
00034 #include "pt_Types.h"
00035 #include "ut_assert.h"
00036 #include "xap_Strings.h"
00037 #include "fl_BlockLayout.h"
00038 #include "pp_Revision.h"
00039 #include "ut_string_class.h"
00040 #include "fp_ContainerObject.h"
00041 
00042 class UT_GrowBuf;
00043 class fp_Line;
00044 class GR_Graphics;
00045 class GR_Font;
00046 class GR_Image;
00047 class PD_Document;
00048 class PP_AttrProp;
00049 struct dg_DrawArgs;
00050 class fl_CharWidths;
00051 class fd_Field;
00052 class fp_HyperlinkRun;
00053 class fp_AnnotationRun;
00054 
00055 struct fp_RunSplitInfo
00056 {
00057     UT_sint32 iLeftWidth;
00058     UT_sint32 iRightWidth;
00059     UT_sint32 iOffset;
00060 };
00061 
00062 // TODO The break type is not used. Is it put here looking forward,
00063 // TODO or is it left from some earlier experiments?
00064 enum FP_RUN_BREAK_TYPE
00065 {
00066     BREAK_AUTO          = 0,
00067     BREAK_AVOID         = 1,
00068     BREAK_ALWAYS        = 2
00069 };
00070 
00071 enum FP_RUN_TYPE
00072 {
00073     FPRUN__FIRST__                  = 1,
00074     FPRUN_TEXT                      = 1,
00075     FPRUN_IMAGE                     = 2,
00076     FPRUN_TAB                       = 3,
00077     FPRUN_FORCEDLINEBREAK           = 4,
00078     FPRUN_FORCEDCOLUMNBREAK         = 5,
00079     FPRUN_FORCEDPAGEBREAK           = 6,
00080     FPRUN_FIELD                     = 7,
00081     FPRUN_FMTMARK                   = 8,
00082     FPRUN_FIELDSTARTRUN             = 9,
00083     FPRUN_FIELDENDRUN               = 10,
00084     FPRUN_ENDOFPARAGRAPH            = 11,
00085     FPRUN_BOOKMARK                  = 12,
00086     FPRUN_HYPERLINK                 = 13,
00087     FPRUN_DIRECTIONMARKER           = 14,
00088     FPRUN_DUMMY                     = 15,
00089     FPRUN_MATH                      = 16,
00090     FPRUN_EMBED                      = 17,
00091     FPRUN__LAST__                   = 18
00092 };
00093 
00094 enum FP_HYPERLINK_TYPE
00095 {
00096     HYPERLINK_NORMAL =1,
00097     HYPERLINK_ANNOTATION = 2
00098 };
00099 
00100 // specifies how setX should handle screen clearing
00101 enum FPRUN_CLEAR_SCREEN
00102 {
00103     FP_CLEARSCREEN_AUTO,
00104     FP_CLEARSCREEN_FORCE,
00105     FP_CLEARSCREEN_NEVER
00106 };
00107 
00108 
00109 /*
00110     fp_Run represents a contiguous homogenous chunk on a single line.
00111     This file also defines the following subclasses:
00112 
00113         fp_TabRun
00114         fp_ForcedLineBreakRun
00115         fp_ForcedColumnBreakRun
00116         fp_ForcedPageBreakRun
00117         fp_ImageRun
00118         fp_FieldRun
00119         fp_FmtMarkRun
00120         fp_FieldStartRun
00121         fp_FieldEndRun
00122         fp_BookmarkRun
00123         fp_HyperlinkRun
00124         fp_AnnotationRun
00125         fp_DummyRun
00126 
00127     As far as the formatter's concerned, each subclass behaves somewhat
00128     differently, but they can all be treated like rectangular blocks to
00129     be arranged.
00130 
00131     Convention: _setFoo(bar) is just this.foo = bar;
00132                  setFoo(bar) sets this.foo to bar,
00133                                but may also do other processing to maintain
00134                                internal state.
00135 */
00136 class ABI_EXPORT fp_Run : fp_ContainerObject
00137 {
00138     friend class fg_FillType;
00139 public:
00140     fp_Run(fl_BlockLayout* pBL, UT_uint32 iOffsetFirst,
00141            UT_uint32 iLen, FP_RUN_TYPE iType);
00142     virtual ~fp_Run();
00143 
00144     // inline getter member functions
00145 
00146     FP_RUN_TYPE             getType() const                 { return m_iType; }
00147     fp_Line*                getLine() const                 { return m_pLine; }
00148     fl_BlockLayout*         getBlock() const                { return m_pBL; }
00149     UT_sint32               getX() const                    { return m_iX; }
00150     UT_sint32               getY() const                    { return m_iY; }
00151 
00152     UT_sint32               getHeight() const;
00153     UT_sint32               getWidth() const;
00154     UT_uint32               getAscent() const;
00155     UT_uint32               getDescent() const;
00156     virtual UT_sint32       getDrawingWidth() const;
00157     
00158     fp_Run*                 getNextRun() const                  { return m_pNext; }
00159     fp_Run*                 getPrevRun() const                  { return m_pPrev; }
00160     bool                    isInSelectedTOC(void);
00161     virtual fp_ContainerObject * getNext(void) const { return NULL;}
00162     virtual fp_ContainerObject * getPrev(void) const { return NULL;}
00163     virtual fp_Container *       getNextContainerInSection(void) const { return NULL;}
00164     virtual fp_Container *       getPrevContainerInSection(void) const { return NULL;}
00165     virtual void                 setNext(fp_ContainerObject * /*pNull*/) {}
00166     virtual void                 setPrev(fp_ContainerObject * /*pNull*/) {}
00167     virtual void                 draw(GR_Graphics * /*pG*/) {}
00168 
00169     UT_uint32           getBlockOffset() const          { return m_iOffsetFirst; }
00170     UT_uint32           getLength() const               { return m_iLen; }
00171     GR_Graphics*        getGraphics() const;
00172     fp_HyperlinkRun *   getHyperlink() const            { return m_pHyperlink;}
00173 #if DEBUG
00174     virtual void        printText(void) {};
00175 #endif
00176 
00177     void                getSpanAP(const PP_AttrProp * &pSpanAP);
00178     const PP_AttrProp * getSpanAP(void);
00179 
00180     
00181     inline void         getBlockAP(const PP_AttrProp * &pBlockAP)
00182                                          {getBlock()->getAP(pBlockAP);}
00183         
00184     
00185     void                insertIntoRunListBeforeThis(fp_Run& newRun);
00186     void                insertIntoRunListAfterThis(fp_Run& newRun);
00187     fd_Field*           getField(void) const { return m_pField; }
00188     bool                isField(void) const { return (bool) (m_pField != NULL); }
00189     void                unlinkFromRunList();
00190 
00191     const UT_RGBColor   getFGColor(void) const;
00192 
00193     virtual bool        hasLayoutProperties(void) const;
00194 
00195     void                setLine(fp_Line*);
00196     void                setBlock(fl_BlockLayout * pBL) { _setBlock(pBL); }
00197     virtual void        setX(UT_sint32 x, bool bDontClearIfNeeded = false);
00198     void                Run_setX(UT_sint32, FPRUN_CLEAR_SCREEN eClearScreen = FP_CLEARSCREEN_AUTO);
00199     virtual void        setY(UT_sint32);
00200     void                setBlockOffset(UT_uint32);
00201     void                setLength(UT_uint32 iLen, bool bRefresh = true);
00202     void                setNextRun(fp_Run*, bool bRefresh = true);
00203     void                setPrevRun(fp_Run*, bool bRefresh = true);
00204     void                setHyperlink(fp_HyperlinkRun * pH);
00205     void                markWidthDirty() {m_bRecalcWidth = true;}
00206     bool                isFirstRunOnLine(void) const;
00207     bool                isLastRunOnLine(void) const;
00208     bool                isOnlyRunOnLine(void) const;
00209     bool                isFirstVisRunOnLine(void) const;
00210     bool                isLastVisRunOnLine(void) const;
00211     void                markDrawBufferDirty()
00212                             {m_eRefreshDrawBuffer = GRSR_Unknown;}
00213     void                orDrawBufferDirty(GRShapingResult eR)
00214                         {
00215                             m_eRefreshDrawBuffer = (GRShapingResult)((UT_uint32)m_eRefreshDrawBuffer
00216                                                                      |(UT_uint32)eR);
00217 }
00218     bool                isPrinting(void) const
00219     { return m_bPrinting;}
00220     virtual void        draw(dg_DrawArgs*);
00221     virtual void        clearScreen(void);
00222     void                Run_ClearScreen(bool bFullLineHeightRect = false);
00223     virtual void        setWidth(UT_sint32 /*iW*/) {}
00224     virtual void        setHeight(UT_sint32 /*iH*/) {}
00225     virtual bool        isVBreakable(void) {return false;}
00226     virtual bool        isHBreakable(void) {return false;}
00227     virtual UT_sint32   wantVBreakAt(UT_sint32 i) {return i;}
00228     virtual UT_sint32   wantHBreakAt(UT_sint32 i) {return i;}
00229     virtual fp_ContainerObject * VBreakAt(UT_sint32) { return NULL;}
00230     virtual fp_ContainerObject * HBreakAt(UT_sint32) { return NULL;}
00231 
00232     void                markAsDirty(void);
00233     void                setCleared(void);
00234     bool                isDirty(void) const { return m_bDirty; }
00235     bool                canContainPoint(void) const;
00236     bool                recalcWidth(void);
00237     virtual void        updateOnDelete(UT_uint32 offset, UT_uint32 iLen);
00238     virtual void        updateVerticalMetric();
00239 
00240     virtual UT_Rect *   getScreenRect();
00241     virtual void        markDirtyOverlappingRuns(UT_Rect & recScreen);
00242 
00243     virtual void        _draw(dg_DrawArgs*) = 0;
00244     void                _drawTextLine(UT_sint32, UT_sint32, UT_uint32, UT_uint32, UT_UCSChar *);
00245     virtual void        _clearScreen(bool bFullLineHeightRect) = 0;
00246     virtual bool        canBreakAfter(void) const = 0;
00247     virtual bool        canBreakBefore(void) const = 0;
00248     bool                letPointPass(void) const;
00249     virtual bool        isForcedBreak(void) const { return false; }
00250     virtual bool        alwaysFits(void) const { return false; }
00251     virtual bool        findMaxLeftFitSplitPoint(UT_sint32 iMaxLeftWidth, fp_RunSplitInfo& si,
00252                                                  bool bForce=false);
00253     
00254     virtual UT_sint32   findTrailingSpaceDistance(void) const { return 0; }
00255     virtual bool        findFirstNonBlankSplitPoint(fp_RunSplitInfo& /*si*/) { return false; }
00256     virtual void        mapXYToPosition(UT_sint32 xPos, UT_sint32 yPos,
00257                                         PT_DocPosition& pos, bool& bBOL, bool& bEOL, bool & isTOC) = 0;
00258     
00259     virtual void        findPointCoords(UT_uint32 iOffset, UT_sint32& x, UT_sint32& y,
00260                                         UT_sint32& x2, UT_sint32& y2, UT_sint32& height,
00261                                         bool& bDirection) = 0;
00262     
00263     void                lookupProperties(GR_Graphics * pG=NULL);
00264     virtual bool        doesContainNonBlankData(void) const { return true; }    // Things like text whould return false if it is all spaces.
00265     void                drawDecors(UT_sint32 xoff, UT_sint32 yoff, GR_Graphics * pG);
00266     virtual bool        isSuperscript(void) const { return false; }
00267     virtual bool        isSubscript(void) const { return false; }
00268     bool                isUnderline(void) const ;
00269     bool                isOverline(void) const ;
00270     bool                isStrikethrough(void) const ;
00271     bool                isTopline(void) const ;
00272     bool                isBottomline(void) const ;
00273     void                setLinethickness(UT_sint32 max_linethickness);
00274     UT_sint32           getLinethickness(void) ;
00275     void                setUnderlineXoff(UT_sint32 xoff);
00276     UT_sint32           getUnderlineXoff(void);
00277     void                setOverlineXoff(UT_sint32 xoff) ;
00278     UT_sint32           getOverlineXoff(void) ;
00279     void                setMaxUnderline(UT_sint32 xoff) ;
00280     UT_sint32           getMaxUnderline(void) ;
00281     void                setMinOverline(UT_sint32 xoff) ;
00282     UT_sint32           getMinOverline(void) ;
00283     UT_sint32           getToplineThickness(void);
00284 
00285     virtual UT_BidiCharType getDirection() const { return m_iDirection; };
00286     UT_BidiCharType     getVisDirection();
00287     virtual void        setDirection(UT_BidiCharType iDirection = UT_BIDI_WS);
00288     void                setVisDirection(UT_BidiCharType iDir);
00289     UT_uint32           getVisPosition(UT_uint32 ilogPos);
00290     UT_uint32           getVisPosition(UT_uint32 iLogPos, UT_uint32 iLen);
00291     UT_uint32           getOffsetFirstVis();
00292     UT_uint32           getOffsetLog(UT_uint32 iVisOff);
00293     fp_Run *            getNextVisual();
00294     fp_Run *            getPrevVisual();
00295     UT_sint32           getAuthorNum(void) const
00296     { return m_iAuthorColor;};
00297     void                setAuthorNum(UT_sint32 i)
00298     { m_iAuthorColor=i;};
00299 
00300     virtual UT_uint32   adjustCaretPosition(UT_uint32 iDocumentPosition, bool /*bForward*/)
00301                                { return iDocumentPosition;}
00302 
00303     virtual void        adjustDeletePosition(UT_uint32 & /*pos1*/, 
00304                                              UT_uint32 & /*count*/) {}
00305 
00306     bool                containsRevisions(){return (m_pRevisions != NULL);}
00307     // would prefer to make the return value const, but the
00308     // getLastRevision() and related functions use internal cache so
00309     // they could not be called
00310     PP_RevisionAttr *   getRevisions() const {return m_pRevisions;}
00311     FPVisibility        getVisibility() const {return m_eVisibility;}
00312     bool         isHidden() const {return _wouldBeHidden(m_eVisibility);}
00313     void                setVisibility(FPVisibility eVis);
00314     void                Fill(GR_Graphics * pG, UT_sint32 x, UT_sint32 y,
00315                              UT_sint32 width, UT_sint32 height);
00316     
00317     fg_FillType *       getFillType(void);            
00318     fp_Line *           getTmpLine(void) const
00319     { return m_pTmpLine;}
00320     void                setTmpLine(fp_Line * pLine)
00321     { m_pTmpLine = pLine;}
00322     UT_sint32           getTmpX(void) const
00323     { return m_iTmpX;}
00324     void                setTmpX(UT_sint32 iX)
00325     { m_iTmpX = iX;}
00326     UT_sint32           getTmpY(void) const
00327     { return m_iTmpY;}
00328     void                setTmpY(UT_sint32 iY)
00329     { m_iTmpY = iY;}
00330     UT_sint32           getTmpWidth(void) const
00331     { return m_iTmpWidth;}
00332     void                setTmpWidth(UT_sint32 iWidth)
00333     { m_iTmpWidth = iWidth;}
00334     bool                clearIfNeeded(void);
00335 
00336     // Indicates that if insertion point is placed at a position belonging to the run
00337     // and delete command is issued, it should apply to the following run (or previous
00338     // in case of backspace). This is used with invisible runs, such as hyperlinks,
00339     // bookmarks, and hidden hidden text, to ensure that these are not deleted behind
00340     // the users backs.
00341     bool        deleteFollowingIfAtInsPoint() const;
00342 
00343     bool        displayAnnotations(void);
00344     // Methods for selection drawing
00345     void                 setSelectionMode(PT_DocPosition posLow, PT_DocPosition posHigh);
00346     void                 clearSelectionMode(void);
00347     bool                 isSelectionDraw(void) const;
00348     PT_DocPosition       posSelLow(void) const;
00349     PT_DocPosition       posSelHigh(void) const;
00350     UT_RGBColor         _getColorFG(void) const { return m_pColorFG; }
00351 
00352 #ifdef FMT_TEST
00353     virtual void        __dump(FILE * fp) const;
00354 #endif
00355     void               setMustClearScreen(void)
00356     { m_bMustClearScreen = true;}
00357     bool               getMustClearScreen(void)
00358     {return m_bMustClearScreen;}
00359 
00360 protected:
00361     virtual bool        _deleteFollowingIfAtInsPoint() const;
00362     void                _inheritProperties(void);
00363     fp_Run*             _findPrevPropertyRun(void) const;
00364 
00365     FV_View*            _getView(void) const { return getBlock()->getView(); }
00366     // By convention, _getFoo and _setFoo have no side effects.
00367     // They can easily be inlined by a smart compiler.
00368     UT_RGBColor         _getColorPG(void) const { return m_pColorPG; }
00369     UT_RGBColor         _getColorHL(void) const { return m_pColorHL; }
00370     void                _setColorFG(UT_RGBColor c) { m_pColorFG = c; }
00371     void                _setColorHL(UT_RGBColor c) { m_pColorHL = c; }
00372     void                _setColorHL(const char *pszColor)
00373         { m_pColorHL.setColor(pszColor); }
00374     
00375     void                _setLine(fp_Line* pLine) { m_pLine = pLine; }
00376     void                _setHeight(UT_sint32 iHeight)
00377                             { m_iHeight = iHeight;}
00378     virtual void        _setWidth(UT_sint32 iWidth)
00379                             { m_iWidth = iWidth; }
00380 
00381     // use these with great care -- most of the time we need to use
00382     // getWidth() and getHeight() which deal with
00383     // visibility/hiddenness issues
00384     UT_sint32           _getWidth() {return m_iWidth;}
00385     UT_sint32           _getHeight(){return m_iHeight;}
00386     
00387     void                _setBlock(fl_BlockLayout * pBL) { m_pBL = pBL; }
00388     void                _setAscent(int iAscent) { m_iAscent = iAscent; }
00389     void                _setDescent(int iDescent) {m_iDescent = iDescent;}
00390     void                _setX(int iX) { m_iX = iX; }
00391     void                _setY(int iY) { m_iY = iY; }
00392     void                _setDirection(UT_BidiCharType c) { m_iDirection = c; }
00393     UT_BidiCharType     _getDirection(void) const { return m_iDirection; }
00394     UT_BidiCharType     _getVisDirection(void) const { return m_iVisDirection; }
00395     const GR_Font *         _getFont(void) const;
00396     void                _setFont(const GR_Font * f);
00397     unsigned char       _getDecorations(void) const { return m_fDecorations; }
00398     void                _setDecorations(unsigned char d) {m_fDecorations = d;}
00399     
00400     void                _orDecorations(unsigned char d) { m_fDecorations |= d; }
00401     UT_sint32           _getLineWidth(void) { return m_iLineWidth; }
00402     bool                _setLineWidth(UT_sint32 w)
00403                              {
00404                                  UT_sint32 o = m_iLineWidth;
00405                                  m_iLineWidth = w;
00406                                  return o != w;
00407                              }
00408     void                _setLength(UT_uint32 l) { m_iLen = l; }
00409     void                _setRevisions(PP_RevisionAttr * p) { m_pRevisions = p; }
00410     void                _setDirty(bool b);
00411     void                _setField(fd_Field * fd) { m_pField = fd; }
00412     void                _setHyperlink(fp_HyperlinkRun * pH) { m_pHyperlink = pH; }
00413     bool                _getRecalcWidth(void) const { return m_bRecalcWidth; }
00414     void                _setRecalcWidth(bool b) { m_bRecalcWidth = b; }
00415 
00416     GRShapingResult     _getRefreshDrawBuffer(void) const { return m_eRefreshDrawBuffer; }
00417     void                _setRefreshDrawBuffer(GRShapingResult eR)
00418                              { m_eRefreshDrawBuffer = eR; }
00419     virtual void        _lookupProperties(const PP_AttrProp * pSpanAP,
00420                                           const PP_AttrProp * pBlockAP,
00421                                           const PP_AttrProp * pSectionAP, 
00422                                           GR_Graphics * pG = NULL) = 0;
00423 
00424     virtual bool        _canContainPoint(void) const;
00425     virtual bool        _letPointPass(void) const;
00426     virtual bool        _recalcWidth(void);
00427     bool         _wouldBeHidden(FPVisibility eVis) const;
00428 //
00429 // Variables to draw underlines for all runs
00430 //
00431     enum
00432     {
00433         TEXT_DECOR_UNDERLINE =      0x01,
00434         TEXT_DECOR_OVERLINE =       0x02,
00435         TEXT_DECOR_LINETHROUGH =    0x04,
00436         TEXT_DECOR_TOPLINE =        0x08,
00437         TEXT_DECOR_BOTTOMLINE =     0x10
00438     };
00439 
00440 private:
00441     fp_Run(const fp_Run&);          // no impl.
00442     void operator=(const fp_Run&);  // no impl.
00443 
00444     FP_RUN_TYPE             m_iType;
00445     fp_Line*                m_pLine;
00446     fl_BlockLayout*         m_pBL;
00447     fp_Run*                 m_pNext;
00448     fp_Run*                 m_pPrev;
00449     UT_sint32               m_iX;
00450     UT_sint32               m_iOldX;
00451     UT_sint32               m_iY;
00452     UT_sint32               m_iWidth;
00453     UT_sint32               m_iHeight;
00454     UT_uint32               m_iAscent;
00455     UT_uint32               m_iDescent;
00456 
00457     UT_uint32               m_iOffsetFirst;
00458     UT_uint32               m_iLen;
00459     bool                    m_bDirty;       // run erased @ old coords, needs to be redrawn
00460     fd_Field*               m_pField;
00461     UT_BidiCharType         m_iDirection;   //#TF direction of the run 0 for left-to-right, 1 for right-to-left
00462     UT_BidiCharType         m_iVisDirection;
00463     GRShapingResult         m_eRefreshDrawBuffer;
00464 
00465     // the run highlight color. If the property is transparent use the page color
00466     UT_RGBColor             m_pColorHL;
00467 
00468     const GR_Font *             m_pFont;
00469 
00470     bool                    m_bRecalcWidth;
00471 
00472     unsigned char           m_fDecorations;
00473     UT_sint32               m_iLineWidth;
00474     UT_sint32               m_iLinethickness;
00475     UT_sint32               m_iUnderlineXoff;
00476     UT_sint32               m_imaxUnderline;
00477     UT_sint32               m_iminOverline;
00478     UT_sint32               m_iOverlineXoff;
00479     fp_HyperlinkRun *       m_pHyperlink;
00480     PP_RevisionAttr *       m_pRevisions;
00481 
00482     // A local cache of the page color. This makes clearscreen() a bit faster
00483     UT_RGBColor             m_pColorPG;
00484     UT_RGBColor             m_pColorFG;
00485     FPVisibility            m_eVisibility;
00486     bool                    m_bIsCleared;
00487     fg_FillType             m_FillType;
00488     bool                    m_bPrinting;
00489     GR_Graphics *           m_pG;
00490     UT_sint32               m_iTmpX;
00491     UT_sint32               m_iTmpY;
00492     UT_sint32               m_iTmpWidth;
00493     fp_Line *               m_pTmpLine;
00494 
00495     // Variables for selection drawing
00496     bool                    m_bDrawSelection;
00497     PT_DocPosition          m_iSelLow;
00498     PT_DocPosition          m_iSelHigh;
00499     bool                    m_bMustClearScreen;
00500     UT_sint32               m_iAuthorColor;
00501 #ifdef DEBUG
00502     UT_uint32               m_iFontAllocNo;
00503 #endif
00504 };
00505 
00506 class ABI_EXPORT fp_TabRun : public fp_Run
00507 {
00508 public:
00509     fp_TabRun(fl_BlockLayout* pBL, UT_uint32 iOffsetFirst, UT_uint32 iLen);
00510     virtual void            mapXYToPosition(UT_sint32 xPos, UT_sint32 yPos, PT_DocPosition& pos, bool& bBOL, bool& bEOL, bool & isTOC);
00511     virtual void            findPointCoords(UT_uint32 iOffset, UT_sint32& x, UT_sint32& y, UT_sint32& x2, UT_sint32& y2, UT_sint32& height, bool& bDirection);
00512     virtual bool            canBreakAfter(void) const;
00513     virtual bool            canBreakBefore(void) const;
00514     virtual bool            hasLayoutProperties(void) const;
00515     void                    setTabWidth(UT_sint32);
00516     void                    setLeader(eTabLeader iTabType);
00517     eTabLeader              getLeader(void);
00518     void                    setTabType(eTabType iTabType);
00519     eTabType                getTabType(void) const;
00520     bool                    isTOCTab(void);
00521     void                    setTOCTab(void)
00522     { m_bIsTOC = true;}
00523     void                    setTOCTabListLabel(void);
00524     bool                    isTOCTabListLabel(void) const
00525     { return m_bIsTOCListLabel;}
00526 
00527 protected:
00528     virtual void            _drawArrow(UT_uint32 iLeft,UT_uint32 iTop,UT_uint32 iWidth, UT_uint32 iHeight);
00529     virtual void            _draw(dg_DrawArgs*);
00530     virtual void            _clearScreen(bool bFullLineHeightRect);
00531     virtual void            _lookupProperties(const PP_AttrProp * pSpanAP,
00532                                               const PP_AttrProp * pBlockAP,
00533                                               const PP_AttrProp * pSectionAP,
00534                                               GR_Graphics * pG = NULL);
00535 
00536     virtual bool            _letPointPass(void) const;
00537 
00538 private:
00539     //UT_RGBColor               m_colorFG;
00540 private:
00541     eTabLeader              m_leader;
00542     eTabType                m_TabType;
00543     bool                    m_bIsTOC;
00544     bool                    m_bIsTOCListLabel;
00545 };
00546 
00547 class ABI_EXPORT fp_ForcedLineBreakRun : public fp_Run
00548 {
00549 public:
00550     fp_ForcedLineBreakRun(fl_BlockLayout* pBL, UT_uint32 iOffsetFirst, UT_uint32 iLen);
00551     virtual void            mapXYToPosition(UT_sint32 xPos, UT_sint32 yPos, PT_DocPosition& pos, bool& bBOL, bool& bEOL, bool & isTOC);
00552     virtual void            findPointCoords(UT_uint32 iOffset, UT_sint32& x, UT_sint32& y, UT_sint32& x2, UT_sint32& y2, UT_sint32& height, bool& bDirection);
00553     virtual bool            canBreakAfter(void) const;
00554     virtual bool            canBreakBefore(void) const;
00555     virtual bool            isForcedBreak(void) const { return true; }
00556 protected:
00557     virtual void            _lookupProperties(const PP_AttrProp * pSpanAP,
00558                                               const PP_AttrProp * pBlockAP,
00559                                               const PP_AttrProp * pSectionAP,
00560                                               GR_Graphics * pG = NULL);
00561 
00562     virtual void            _draw(dg_DrawArgs*);
00563     virtual void            _clearScreen(bool bFullLineHeightRect);
00564     virtual bool            _letPointPass(void) const;
00565 };
00566 
00567 class ABI_EXPORT fp_FieldStartRun : public fp_Run
00568 {
00569 public:
00570     fp_FieldStartRun(fl_BlockLayout* pBL, UT_uint32 iOffsetFirst, UT_uint32 iLen);
00571     virtual void            mapXYToPosition(UT_sint32 xPos, UT_sint32 yPos, PT_DocPosition& pos, bool& bBOL, bool& bEOL, bool & isTOC);
00572     virtual void            findPointCoords(UT_uint32 iOffset, UT_sint32& x, UT_sint32& y, UT_sint32& x2, UT_sint32& y2, UT_sint32& height, bool& bDirection);
00573     virtual bool            canBreakAfter(void) const;
00574     virtual bool            canBreakBefore(void) const;
00575     virtual bool            isForcedBreak(void) const { return true; }
00576 protected:
00577     virtual void            _lookupProperties(const PP_AttrProp * pSpanAP,
00578                                               const PP_AttrProp * pBlockAP,
00579                                               const PP_AttrProp * pSectionAP,
00580                                               GR_Graphics * pG = NULL);
00581 
00582     virtual void            _draw(dg_DrawArgs*);
00583     virtual void            _clearScreen(bool bFullLineHeightRect);
00584     virtual bool            _letPointPass(void) const;
00585 };
00586 
00587 class ABI_EXPORT fp_FieldEndRun : public fp_Run
00588 {
00589 public:
00590     fp_FieldEndRun(fl_BlockLayout* pBL, UT_uint32 iOffsetFirst, UT_uint32 iLen);
00591     virtual void            mapXYToPosition(UT_sint32 xPos, UT_sint32 yPos, PT_DocPosition& pos, bool& bBOL, bool& bEOL, bool & isTOC);
00592     virtual void            findPointCoords(UT_uint32 iOffset, UT_sint32& x, UT_sint32& y, UT_sint32& x2, UT_sint32& y2, UT_sint32& height, bool& bDirection);
00593     virtual bool            canBreakAfter(void) const;
00594     virtual bool            canBreakBefore(void) const;
00595     virtual bool            isForcedBreak(void) const { return true; }
00596 protected:
00597     virtual void            _lookupProperties(const PP_AttrProp * pSpanAP,
00598                                               const PP_AttrProp * pBlockAP,
00599                                               const PP_AttrProp * pSectionAP,
00600                                               GR_Graphics * pG = NULL);
00601 
00602     virtual void            _draw(dg_DrawArgs*);
00603     virtual void            _clearScreen(bool bFullLineHeightRect);
00604     virtual bool            _letPointPass(void) const;
00605 };
00606 
00607 class ABI_EXPORT fp_ForcedColumnBreakRun : public fp_Run
00608 {
00609 public:
00610     fp_ForcedColumnBreakRun(fl_BlockLayout* pBL, UT_uint32 iOffsetFirst, UT_uint32 iLen);
00611 
00612     virtual void            mapXYToPosition(UT_sint32 xPos, UT_sint32 yPos, PT_DocPosition& pos, bool& bBOL, bool& bEOL, bool & isTOC);
00613     virtual void            findPointCoords(UT_uint32 iOffset, UT_sint32& x, UT_sint32& y, UT_sint32& x2, UT_sint32& y2, UT_sint32& height, bool& bDirection);
00614     virtual bool            canBreakAfter(void) const;
00615     virtual bool            canBreakBefore(void) const;
00616     virtual bool            isForcedBreak(void) const { return true; }
00617 protected:
00618     virtual void            _lookupProperties(const PP_AttrProp * pSpanAP,
00619                                               const PP_AttrProp * pBlockAP,
00620                                               const PP_AttrProp * pSectionAP,
00621                                               GR_Graphics * pG = NULL);
00622 
00623     virtual void            _draw(dg_DrawArgs*);
00624     virtual void            _clearScreen(bool bFullLineHeightRect);
00625     virtual bool            _letPointPass(void) const;
00626 };
00627 
00628 class ABI_EXPORT fp_ForcedPageBreakRun : public fp_Run
00629 {
00630 public:
00631     fp_ForcedPageBreakRun(fl_BlockLayout* pBL, UT_uint32 iOffsetFirst, UT_uint32 iLen);
00632     virtual void            mapXYToPosition(UT_sint32 xPos, UT_sint32 yPos, PT_DocPosition& pos, bool& bBOL, bool& bEOL, bool & isTOC);
00633     virtual void            findPointCoords(UT_uint32 iOffset, UT_sint32& x, UT_sint32& y, UT_sint32& x2, UT_sint32& y2, UT_sint32& height, bool& bDirection);
00634     virtual bool            canBreakAfter(void) const;
00635     virtual bool            canBreakBefore(void) const;
00636     virtual bool            isForcedBreak(void) const { return true; }
00637 
00638 protected:
00639     virtual void            _lookupProperties(const PP_AttrProp * pSpanAP,
00640                                               const PP_AttrProp * pBlockAP,
00641                                               const PP_AttrProp * pSectionAP,
00642                                               GR_Graphics * pG = NULL);
00643 
00644     virtual void            _draw(dg_DrawArgs*);
00645     virtual void            _clearScreen(bool bFullLineHeigh