• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

fl_BlockLayout.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  * BIDI 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 #ifndef FL_BLOCKLAYOUT_H
00024 #define FL_BLOCKLAYOUT_H
00025 
00026 #ifdef HAVE_CONFIG_H
00027 #include "config.h"
00028 #endif
00029 
00030 #ifdef FMT_TEST
00031 #include <stdio.h>
00032 #endif
00033 
00034 #include "ut_misc.h"
00035 #include "ut_types.h"
00036 #include "ut_vector.h"
00037 #include "ut_growbuf.h"
00038 #include "ut_xml.h"
00039 #include "pt_Types.h"
00040 #include "fl_Layout.h"
00041 #include "fl_DocLayout.h"       // FIXME: this is needed for the friend'ed function
00042 #include "fg_Graphic.h"
00043 #include "fl_AutoLists.h"
00044 #include "pp_Property.h"
00045 #include "fl_ContainerLayout.h"
00046 #include "fl_SectionLayout.h"
00047 #include "fb_LineBreaker.h"
00048 #include "ut_string_class.h"
00049 #include "ut_misc.h"
00050 #include "pp_PropertyMap.h"
00051 
00052 // number of DocPositions occupied by the block strux
00053 #define fl_BLOCK_STRUX_OFFSET   1
00054 
00055 class fl_Squiggles;
00056 class fl_SpellSquiggles;
00057 class fl_GrammarSquiggles;
00058 class FL_DocLayout;
00059 class fl_SectionLayout;
00060 class fl_ContainerLayout;
00061 class fb_LineBreaker;
00062 class fb_Alignment;
00063 class fp_Line;
00064 class fp_Run;
00065 class GR_Graphics;
00066 class PD_Document;
00067 class PP_Property;
00068 class PX_ChangeRecord_FmtMark;
00069 class PX_ChangeRecord_FmtMarkChange;
00070 class PX_ChangeRecord_Object;
00071 class PX_ChangeRecord_ObjectChange;
00072 class PX_ChangeRecord_Span;
00073 class PX_ChangeRecord_SpanChange;
00074 class PX_ChangeRecord_Strux;
00075 class PX_ChangeRecord_StruxChange;
00076 class pf_Frag_Strux;
00077 class pf_Frag_Object;
00078 class fl_AutoNum;
00079 class fp_VerticalContainer;
00080 class fp_HyperlinkRun;
00081 
00082 // Tab types and leaders
00083 typedef enum {
00084     FL_TAB_NONE = 0,
00085     FL_TAB_LEFT,
00086     FL_TAB_CENTER,
00087     FL_TAB_RIGHT,
00088     FL_TAB_DECIMAL,
00089     FL_TAB_BAR,
00090     __FL_TAB_MAX
00091 } eTabType;
00092 
00093 typedef enum {
00094     FL_LEADER_NONE = 0,
00095     FL_LEADER_DOT,
00096     FL_LEADER_HYPHEN,
00097     FL_LEADER_UNDERLINE,
00098     FL_LEADER_THICKLINE,
00099     FL_LEADER_EQUALSIGN,
00100     __FL_LEADER_MAX
00101 } eTabLeader;
00102 
00103 
00104 /*
00105     Blocks are stored in a linked list which contains all of the blocks in
00106     the normal flow, in order.
00107 */
00108 
00109 class SpellChecker;
00110 class fl_TabStop;
00111 ABI_EXPORT void buildTabStops(const char* pszTabStops, UT_GenericVector<fl_TabStop*> &m_vecTabs);
00112 
00113 class ABI_EXPORT fl_BlockLayout : public fl_ContainerLayout
00114 {
00115     friend class fl_Squiggles;
00116     friend class fl_SpellSquiggles;
00117     friend class fl_GrammarSquiggles;
00118     friend class fl_DocListener;
00119     friend class fl_TOCLayout;
00120     friend class fb_LineBreaker;
00121 
00122 #ifdef ENABLE_SPELL
00123     // TODO: shack - code should be moved from toggleAuto to a function in
00124     // here - to handle the squiggles
00125     friend void FL_DocLayout::_toggleAutoSpell(bool bSpell);
00126 #endif
00127 
00128 public:
00129     fl_BlockLayout(pf_Frag_Strux* sdh,
00130                    fl_ContainerLayout* pPrev, fl_SectionLayout*,
00131                    PT_AttrPropIndex indexAP, bool bIsHdrFtr = false);
00132     ~fl_BlockLayout();
00133 
00134     typedef enum _eSpacingPolicy
00135     {
00136         spacing_MULTIPLE,
00137         spacing_EXACT,
00138         spacing_ATLEAST
00139     } eSpacingPolicy;
00140 
00141     void                formatAll(void);
00142     virtual void        format(void);
00143     void                formatWrappedFromHere(fp_Line * pLine,fp_Page * pPage);
00144     fp_Line *           getNextWrappedLine(UT_sint32 iX,
00145                                               UT_sint32 iHeight,
00146                                            fp_Page * pPage);
00147     void                getLeftRightForWrapping(UT_sint32 iX,
00148                                                 UT_sint32 iHeight,
00149                                                 UT_sint32 & iMinLeft,
00150                                                 UT_sint32 & iMinRight,
00151                                                 UT_sint32 & iMinWidth);
00152     virtual bool        recalculateFields(UT_uint32 iUpdateCount);
00153 
00154     virtual void        redrawUpdate();
00155     virtual void        updateLayout(bool /*bDoAll*/) {}
00156     virtual fp_Container * getNewContainer(fp_Container * pCon = NULL);
00157     FV_View *       getView(void) const {
00158         UT_return_val_if_fail( m_pLayout, NULL );
00159         return m_pLayout->getView();
00160     }
00161 
00162     const char* getProperty(const gchar * pszName, bool bExpandStyles = true) const;
00163     const PP_PropertyType * getPropertyType(const gchar * szName,
00164                                             tProperty_type Type, bool bExpandStyles = true) const;
00165     void setAlignment(UT_uint32 iAlignCmd);
00166     UT_sint32       getLength(void) const;
00167     bool            isEmbeddedType(void) const;
00168     bool            isNotTOCable(void) const;
00169     bool            isLastRunInBlock(fp_Run * pRun) const;
00170     void            updateOffsets(PT_DocPosition posEmbedded,
00171                                   UT_uint32 iEmebbedSize, UT_sint32 iSuggestedDiff);
00172     void            updateEnclosingBlockIfNeeded(void);
00173     fl_BlockLayout * getEnclosingBlock(void) const;
00174     UT_sint32       getEmbeddedOffset(UT_sint32 startOffset, fl_ContainerLayout *& pEmbedCL) const;
00175     void            shuffleEmbeddedIfNeeded(fl_BlockLayout * pBlock, UT_uint32 blockOffset);
00176 
00177     bool            getXYOffsetToLine(UT_sint32 & xoff, UT_sint32 & yoff, fp_Line * pLine) const;
00178     bool            setFramesOnPage(fp_Line * pLastLine);
00179     UT_sint32       getMinWrapWidth(void) const;
00180     UT_sint32       getHeightOfBlock(bool b_withMargins = true);
00181     fp_Line *       findLineWithFootnotePID(UT_uint32 pid) const;
00182     UT_sint32 getMaxNonBreakableRun(void) const;
00183     fp_Line* findPrevLineInDocument(fp_Line*) const;
00184     fp_Line* findNextLineInDocument(fp_Line*) const;
00185     virtual void     appendTextToBuf(UT_GrowBuf & buf) const;
00186     void             appendUTF8String(UT_UTF8String & sText) const;
00187     virtual fp_Run* getFirstRun(void) const { return m_pFirstRun; }
00188     inline void setFirstRun(fp_Run* pRun) { m_pFirstRun = pRun; }
00189     void        clearPrint(void) const;
00190     inline bool isListItem(void) const { return m_bListItem; }
00191     bool isFirstInList(void) const;
00192 //  inline fl_AutoNum * getAutoNum(void) const { return m_pAutoNum; }
00193     void    getListAttributesVector(UT_GenericVector<const gchar*> * va) const;
00194     void  getListPropertyVector(UT_GenericVector<const gchar*> * vp) const;
00195 
00196     void  refreshRunProperties(void) const;
00197     char *  getFormatFromListType(FL_ListType iListType) const;
00198     void remItemFromList(void);
00199     virtual void listUpdate(void);
00200     void resumeList( fl_BlockLayout * prevList);
00201     void prependList( fl_BlockLayout * nextList);
00202     FL_ListType decodeListType(char * listformat) const;
00203     FL_ListType getListType(void) const;
00204     gchar* getListStyleString( FL_ListType iListType) const;
00205     FL_ListType getListTypeFromStyle( const gchar * style) const;
00206     fl_BlockLayout * getNextList(UT_uint32 id) const;
00207     bool isListLabelInBlock(void) const;
00208     void StartList( const gchar * style, pf_Frag_Strux* prevSDH = NULL);
00209 
00210     void StartList( FL_ListType lType, UT_uint32 start,
00211                     const gchar * lDelim, const gchar * lDecimal,
00212                     const gchar * fFont, float Align, float indent,
00213                     UT_uint32 iParentID = 0, UT_uint32 level=0 );
00214 
00215     void StopListInBlock(void);
00216     void deleteListLabel(void);
00217     UT_UCSChar * getListLabel(void) const;
00218     void transferListFlags(void);
00219     UT_uint32 getLevel(void) const;
00220     void setStarting( bool bValue);
00221     void setStopping( bool bValue);
00222     fl_BlockLayout * getPreviousList(UT_uint32 id) const;
00223     fl_BlockLayout * getPreviousList(void) const;
00224     fl_BlockLayout * getPreviousListOfSameMargin(void) const;
00225     fl_BlockLayout * getParentItem(void) const;
00226 
00227 #ifdef ENABLE_SPELL
00228     void findSpellSquigglesForRun(fp_Run* pRun) const;
00229     void drawGrammarSquiggles(void) const;
00230     void findGrammarSquigglesForRun(fp_Run* pRun) const;
00231 #endif
00232 
00233     UT_uint32 canSlurp(fp_Line* pLine) const;
00234 
00235     PT_DocPosition getPosition(bool bActualBlockPos=false) const;
00236     fp_Run* findPointCoords(PT_DocPosition position, bool bEOL,
00237                             UT_sint32& x, UT_sint32& y, UT_sint32& x2,
00238                             UT_sint32& y2, UT_sint32& height, bool& bDirection) const;
00239 
00240     fp_Run* findRunAtOffset(UT_uint32 offset) const;
00241 
00242     bool    getBlockBuf(UT_GrowBuf * pgb) const;
00243 
00244     void clearScreen(GR_Graphics*) const;
00245 
00246 
00247     void                getStyle(UT_UTF8String & sStyle) const;
00248     UT_sint32           getTextIndent(void) const;
00249     inline UT_sint32    getLeftMargin(void) const { return m_iLeftMargin; }
00250     inline UT_sint32    getRightMargin(void) const { return m_iRightMargin; }
00251     inline UT_sint32    getTopMargin(void) const { return m_iTopMargin; }
00252     inline UT_sint32    getBottomMargin(void) const { return m_iBottomMargin; }
00253     inline fb_Alignment *       getAlignment(void) const { return m_pAlignment; }
00254     virtual FL_DocLayout*       getDocLayout(void) const { return m_pLayout; }
00255     virtual fl_SectionLayout*   getSectionLayout(void) const { return m_pSectionLayout;}
00256     fl_DocSectionLayout * getDocSectionLayout(void) const;
00257 
00258     void setSectionLayout(fl_SectionLayout* pSectionLayout);
00259 
00260     void getLineSpacing(double& dSpacing,
00261                         eSpacingPolicy& eSpacing) const;
00262 
00263     inline UT_uint32 getProp_Orphans(void) const { return m_iOrphansProperty; }
00264     inline UT_uint32 getProp_Widows(void) const { return m_iWidowsProperty; }
00265     inline bool getProp_KeepTogether(void) const { return m_bKeepTogether; }
00266     inline bool getProp_KeepWithNext(void) const { return m_bKeepWithNext; }
00267 
00268     inline UT_BidiCharType getDominantDirection(void) const { return m_iDomDirection; }
00269     void setDominantDirection(UT_BidiCharType iDirection);
00270 
00271 #ifdef ENABLE_SPELL
00272     inline fl_SpellSquiggles* getSpellSquiggles(void) const { return m_pSpellSquiggles; }
00273     inline fl_GrammarSquiggles* getGrammarSquiggles(void) const { return  m_pGrammarSquiggles; }
00274 #endif
00275 
00276     bool isHdrFtr(void) const;
00277     void setHdrFtr(void) { m_bIsHdrFtr = true;}
00278     void clearHdrFtr(void) { m_bIsHdrFtr = false;}
00279 
00280 #ifdef ENABLE_SPELL
00281     bool checkSpelling(void);
00282 #endif
00283     void debugFlashing(void);
00284     bool    findNextTabStop(UT_sint32 iStartX, UT_sint32 iMaxX,
00285                             UT_sint32& iPosition, eTabType& iType,
00286                             eTabLeader &iLeader ) const;
00287     bool    findPrevTabStop(UT_sint32 iStartX, UT_sint32 iMaxX,
00288                             UT_sint32& iPosition, eTabType& iType,
00289                             eTabLeader &iLeader ) const;
00290     bool    hasUpdatableField(void) { return m_bHasUpdatableField;}
00291     void    setUpdatableField(bool bValue) { m_bHasUpdatableField = bValue;}
00292     inline UT_sint32 getDefaultTabInterval(void) const { return m_iDefaultTabInterval; }
00293     inline UT_sint32 getTabsCount(void) const {
00294         return m_vecTabs.getItemCount();
00295     }
00296 
00297     bool doclistener_populateSpan(const PX_ChangeRecord_Span * pcrs, PT_BlockOffset blockOffset, UT_uint32 len);
00298     bool doclistener_populateObject(PT_BlockOffset blockOffset, const PX_ChangeRecord_Object * pcro);
00299 
00300     bool doclistener_insertSpan(const PX_ChangeRecord_Span * pcrs);
00301     bool doclistener_deleteSpan(const PX_ChangeRecord_Span * pcrs);
00302     bool doclistener_changeSpan(const PX_ChangeRecord_SpanChange * pcrsc);
00303     bool doclistener_deleteStrux(const PX_ChangeRecord_Strux * pcrx);
00304     bool doclistener_changeStrux(const PX_ChangeRecord_StruxChange * pcrxc);
00305     bool doclistener_insertFirstBlock(const PX_ChangeRecord_Strux * pcrx,
00306                                       pf_Frag_Strux* sdh,
00307                                       PL_ListenerId lid,
00308                                       void (* pfnBindHandles)(pf_Frag_Strux* sdhNew,
00309                                                               PL_ListenerId lid,
00310                                                               fl_ContainerLayout* sfhNew));
00311     bool doclistener_insertBlock(const PX_ChangeRecord_Strux * pcrx,
00312                                  pf_Frag_Strux* sdh,
00313                                  PL_ListenerId lid,
00314                                  void (* pfnBindHandles)(pf_Frag_Strux* sdhNew,
00315                                                          PL_ListenerId lid,
00316                                                          fl_ContainerLayout* sfhNew));
00317     bool doclistener_insertSection(const PX_ChangeRecord_Strux * pcrx,
00318                                    SectionType iType,
00319                                    pf_Frag_Strux* sdh,
00320                                    PL_ListenerId lid,
00321                                    void (* pfnBindHandles)(pf_Frag_Strux* sdhNew,
00322                                                            PL_ListenerId lid,
00323                                                            fl_ContainerLayout* sfhNew));
00324 
00325     fl_SectionLayout *  doclistener_insertTable(const PX_ChangeRecord_Strux * pcrx,
00326                                    SectionType iType,
00327                                    pf_Frag_Strux* sdh,
00328                                    PL_ListenerId lid,
00329                                    void (* pfnBindHandles)(pf_Frag_Strux* sdhNew,
00330                                                            PL_ListenerId lid,
00331                                                            fl_ContainerLayout* sfhNew));
00332     fl_SectionLayout *  doclistener_insertFrame(const PX_ChangeRecord_Strux * pcrx,
00333                                    SectionType iType,
00334                                    pf_Frag_Strux* sdh,
00335                                    PL_ListenerId lid,
00336                                    void (* pfnBindHandles)(pf_Frag_Strux* sdhNew,
00337                                                            PL_ListenerId lid,
00338                                                            fl_ContainerLayout* sfhNew));
00339 
00340     bool doclistener_insertObject(const PX_ChangeRecord_Object * pcro);
00341     bool doclistener_deleteObject(const PX_ChangeRecord_Object * pcro);
00342     bool doclistener_changeObject(const PX_ChangeRecord_ObjectChange * pcroc);
00343 
00344     bool doclistener_insertFmtMark(const PX_ChangeRecord_FmtMark * pcrfm);
00345     bool doclistener_deleteFmtMark(const PX_ChangeRecord_FmtMark * pcrfm);
00346     bool doclistener_changeFmtMark(const PX_ChangeRecord_FmtMarkChange * pcrfmc);
00347 
00348     void                    purgeLayout(void);
00349     virtual void            collapse(void);
00350     virtual bool            isCollapsed(void) const
00351         {return m_bIsCollapsed;}
00352     void                    coalesceRuns(void) const;
00353     virtual void            setNeedsReformat(fl_ContainerLayout * pCL, UT_uint32 offset = 0);
00354     inline bool             needsReformat(void) const
00355         { return (m_iNeedsReformat >= 0); }
00356     virtual void            setNeedsRedraw(void);
00357     virtual bool            needsRedraw(void) const
00358         { return m_bNeedsRedraw; }
00359     virtual void            markAllRunsDirty(void);
00360     UT_sint32               findLineInBlock(fp_Line * pLine) const;
00361 
00362     bool                    isWordDelimiter(UT_UCS4Char c, UT_UCS4Char next, UT_UCS4Char prev, UT_uint32 iBlockPos) const;
00363     bool                    isSentenceSeparator(UT_UCS4Char c, UT_uint32 iBlockPos) const;
00364 #ifdef ENABLE_SPELL
00365     bool                    checkWord(fl_PartOfBlock* pPOB) const;
00366     void                    recheckIgnoredWords();
00367 #endif
00368     void                    setStyleInTOC(bool b)
00369     {   m_bStyleInTOC = b;}
00370     void                    forceSectionBreak(void);
00371     bool                    isContainedByTOC(void) const
00372         { return m_bIsTOC;}
00373     FootnoteType            getTOCNumType(void) const;
00374     eTabLeader              getTOCTabLeader(UT_sint32 iOff) const;
00375     UT_sint32               getTOCTabPosition(UT_sint32 iOff) const;
00376     void                    setAccumHeight(UT_sint32 i)
00377     { m_iAccumulatedHeight =i;}
00378     UT_sint32               getAccumHeight(void) const
00379     { return m_iAccumulatedHeight;}
00380     static bool         s_EnumTabStops(void * myThis, UT_uint32 k, fl_TabStop *pTabInfo);
00381 
00382     inline void         addBackgroundCheckReason(UT_uint32 reason) {m_uBackgroundCheckReasons |= reason;}
00383     inline void         removeBackgroundCheckReason(UT_uint32 reason) {m_uBackgroundCheckReasons &= ~reason;}
00384     inline bool     hasBackgroundCheckReason(UT_uint32 reason) const {return ((m_uBackgroundCheckReasons & reason) ? true : false);}
00385 
00386     // The following is a set of bit flags giving the reason this block is
00387     // queued for background checking.  See specific values in fl_DocLayout.h
00388     UT_uint32               m_uBackgroundCheckReasons;
00389     void                    setPrevListLabel(bool b)
00390     { m_bPrevListLabel = b;}
00391     bool                    getNextTableElement(UT_GrowBuf * buf,
00392                                                 PT_DocPosition startPos,
00393                                                 PT_DocPosition & begPos,
00394                                                 PT_DocPosition & endPos,
00395                                                 UT_UTF8String & sWord,
00396                                                 bool bIgnoreSpace) const;
00397     bool                   itemizeSpan(PT_BlockOffset blockOffset, UT_uint32 len,GR_Itemization & I);
00398     const UT_RGBColor      getShadingingForeColor(void) const;
00399     const UT_RGBColor      getShadingingBackColor(void) const;
00400     UT_sint32              getPattern(void) const;
00401 
00402     const PP_PropertyMap::Line & getBottom () const { return m_lineBottom; }
00403     const PP_PropertyMap::Line & getLeft ()   const { return m_lineLeft; }
00404     const PP_PropertyMap::Line & getRight ()  const { return m_lineRight; }
00405     const PP_PropertyMap::Line & getTop ()    const { return m_lineTop; }
00406 
00407     bool                   hasBorders(void) const;
00408     bool                   canMergeBordersWithPrev(void) const;
00409     bool                   canMergeBordersWithNext(void) const;
00410     void                   setLineHeightBlockWithBorders(int whichLine = 0);
00411 
00412 #ifdef ENABLE_SPELL
00413 
00414     void enqueueToSpellCheckAfter(fl_BlockLayout *prev);
00416     void dequeueFromSpellCheck(void);
00418     void clearQueueing(void)
00419     {
00420         m_prevToSpell = m_nextToSpell = NULL;
00421     }
00422     fl_BlockLayout *nextToSpell(void) const
00423     {
00424         return m_nextToSpell;
00425     }
00427     bool isQueued(void) const
00428     {
00429         return (m_prevToSpell != NULL)
00430             || (m_pLayout->spellQueueHead() == this);
00431     }
00432 #endif
00433 
00434 #ifdef FMT_TEST
00435     void                    __dump(FILE * fp) const;
00436 #endif
00437 
00438 private:
00439     virtual bool            _canContainPoint() const;
00440 
00441 protected:
00442 
00443     void                    _recalcPendingWord(UT_uint32 iOffset, UT_sint32 chg) const;
00444     bool                    _doCheckWord(fl_PartOfBlock* pPOB,
00445                                          const UT_UCSChar* pBlockText,
00446                                          UT_sint32 iLength,
00447                                          bool bAddSquiggle = true,
00448                                          bool bClearScreen = true) const;
00449 
00450 #ifdef ENABLE_SPELL
00451     bool                    _spellCheckWord(const UT_UCSChar * word, UT_uint32 len, UT_uint32 blockPos) const;
00452     SpellChecker * _getSpellChecker (UT_uint32 blockPos) const;
00453 #endif
00454 
00455     bool                    _truncateLayout(fp_Run* pTruncRun);
00456 
00457 #ifndef NDEBUG
00458     void                    _assertRunListIntegrityImpl(void) const;
00459 #endif
00460     void                        _assertRunListIntegrity(void) const;
00461 
00462     void                    _mergeRuns(fp_Run* pFirstRunToMerge, fp_Run* pLastRunToMerge) const;
00463 
00464     bool                    _doInsertRun(fp_Run* pNewRun);
00465     bool                    _delete(PT_BlockOffset blockOffset, UT_uint32 len);
00466     bool                    _doInsertTextSpan(PT_BlockOffset blockOffset, UT_uint32 len);
00467     bool                    _doInsertForcedLineBreakRun(PT_BlockOffset blockOffset);
00468     bool                    _doInsertFieldStartRun(PT_BlockOffset blockOffset);
00469     bool                    _doInsertFieldEndRun(PT_BlockOffset blockOffset);
00470     bool                    _doInsertBookmarkRun(PT_BlockOffset blockOffset);
00471     bool                    _doInsertHyperlinkRun(PT_BlockOffset blockOffset);
00472     bool                    _doInsertAnnotationRun(PT_BlockOffset blockOffset);
00473     bool                    _doInsertRDFAnchorRun(PT_BlockOffset blockOffset);
00474     void                    _finishInsertHyperlinkedNewRun( PT_BlockOffset blockOffset, fp_HyperlinkRun* pNewRun );
00475     bool                    _doInsertMathRun(PT_BlockOffset blockOffset,PT_AttrPropIndex indexAP,pf_Frag_Object* oh);
00476     bool                    _doInsertEmbedRun(PT_BlockOffset blockOffset,PT_AttrPropIndex indexAP,pf_Frag_Object* oh);
00477 //  bool                    _deleteBookmarkRun(PT_BlockOffset blockOffset);
00478     bool                    _doInsertForcedColumnBreakRun(PT_BlockOffset blockOffset);
00479     bool                    _doInsertForcedPageBreakRun(PT_BlockOffset blockOffset);
00480     bool                    _doInsertTabRun(PT_BlockOffset blockOffset);
00481     bool                    _doInsertTOCTabRun(PT_BlockOffset blockOffset);
00482     bool                    _doInsertTOCListLabelRun(PT_BlockOffset blockOffset);
00483     bool                    _doInsertTOCHeadingRun(PT_BlockOffset blockOffset);
00484     bool                    _doInsertTOCListTabRun(PT_BlockOffset blockOffset);
00485     bool                    _doInsertImageRun(PT_BlockOffset blockOffset, FG_Graphic* pFG, pf_Frag_Object* oh);
00486     bool                    _doInsertFieldRun(PT_BlockOffset blockOffset, const PX_ChangeRecord_Object * pcro);
00487     bool                    _doInsertFieldTOCRun(PT_BlockOffset blockOffset);
00488     bool                    _doInsertDirectionMarkerRun(PT_BlockOffset blockOffset, UT_UCS4Char iM);
00489     bool                    _deleteFmtMark(PT_BlockOffset blockOffset);
00490 
00491     virtual void            _lookupProperties(const PP_AttrProp* pAP);
00492     virtual void            _lookupMarginProperties(const PP_AttrProp* pAP);
00493     void                    _removeLine(fp_Line*, bool bRemoveFromContainer, bool bReCalc);
00494     void                    _purgeLine(fp_Line*);
00495     void                    _removeAllEmptyLines(void);
00496 
00497     bool                    _checkMultiWord(UT_sint32 iStart,
00498                                             UT_sint32 eor,
00499                                             bool bToggleIP) const;
00500 
00501     UT_uint32               _getLastChar();
00502     void                    _stuffAllRunsOnALine(void);
00503     void                    _insertEndOfParagraphRun(void);
00504     void                    _purgeEndOfParagraphRun(void);
00505     void                    _breakLineAfterRun(fp_Run* /*pRun*/);
00506 
00507     static void             _prefsListener(XAP_Prefs *pPrefs, UT_StringPtrMap * /*phChanges*/, void * data);
00508 
00509     void                    _createListLabel(void);
00510     void                    _deleteListLabel(void);
00511     inline void             _addBlockToPrevList( fl_BlockLayout * prevBlockInList, UT_uint32 level);
00512     inline void             _prependBlockToPrevList( fl_BlockLayout * nextBlockInList);
00513     UT_sint32               m_iNeedsReformat; // will store offset
00514                                               // from which reformat
00515                                               // is need, -1 if not
00516     bool                    m_bNeedsRedraw;
00517     bool                    m_bIsHdrFtr;
00518 
00519     FL_DocLayout*           m_pLayout;
00520     fb_LineBreaker          m_Breaker;
00521 
00522     fp_Run*                 m_pFirstRun;
00523     fl_SectionLayout*       m_pSectionLayout;
00524 
00525     UT_GenericVector<fl_TabStop*>   m_vecTabs;
00526     UT_sint32               m_iDefaultTabInterval;
00527     // read-only caches of the underlying properties
00528     UT_uint32               m_iOrphansProperty;
00529     UT_uint32               m_iWidowsProperty;
00530     UT_sint32               m_iTopMargin;
00531     UT_sint32               m_iBottomMargin;
00532     UT_sint32               m_iLeftMargin;
00533     UT_sint32               m_iRightMargin;
00534     UT_sint32               m_iTextIndent;
00535     fb_Alignment *          m_pAlignment;
00536     double                  m_dLineSpacing;
00537     //bool                  m_bExactSpacing;
00538     eSpacingPolicy          m_eSpacingPolicy;
00539     bool                    m_bKeepTogether;
00540     bool                    m_bKeepWithNext;
00541 
00542     bool                    m_bStartList;
00543     bool                    m_bStopList;
00544     bool                    m_bListLabelCreated;
00545 #ifdef ENABLE_SPELL
00546     fl_SpellSquiggles *     m_pSpellSquiggles;
00547     fl_GrammarSquiggles *   m_pGrammarSquiggles;
00548     fl_BlockLayout          *m_nextToSpell;
00549     fl_BlockLayout          *m_prevToSpell;
00550 #endif
00551     bool                    m_bListItem;
00552     const gchar *       m_szStyle;
00553     bool                    m_bIsCollapsed;
00554     bool                    m_bHasUpdatableField;
00555 
00556     UT_BidiCharType         m_iDomDirection;
00557     UT_BidiCharType         m_iDirOverride;
00558 
00559     bool                    m_bIsTOC;
00560     bool                    m_bStyleInTOC;
00561     UT_sint32               m_iTOCLevel;
00562 
00563     bool                    m_bSameYAsPrevious;
00564     UT_sint32               m_iAccumulatedHeight;
00565     fp_VerticalContainer *  m_pVertContainer;
00566     UT_sint32               m_iLinePosInContainer;
00567     bool                    m_bForceSectionBreak;
00568     bool                    m_bPrevListLabel;
00569     UT_sint32               m_iAdditionalMarginAfter;
00570     UT_RGBColor             m_ShadingForeColor;
00571     UT_RGBColor             m_ShadingBackColor;
00572     UT_sint32               m_iPattern;
00573 
00574     PP_PropertyMap::Line    m_lineBottom;
00575     PP_PropertyMap::Line    m_lineLeft;
00576     PP_PropertyMap::Line    m_lineRight;
00577     PP_PropertyMap::Line    m_lineTop;
00578     bool                    m_bCanMergeBordersWithNext;
00579     bool                    m_bHasBorders;
00580 };
00581 
00582 /*
00583     This class is used to represent a part of the block.  Pointers
00584     to this class are the things contained in m_vecSquiggles and in
00585     FL_DocLayout::m_pPendingWordForSpell
00586 */
00587 class ABI_EXPORT fl_PartOfBlock
00588 {
00589 public:
00590     fl_PartOfBlock();
00591     fl_PartOfBlock(UT_sint32 iOffset, UT_sint32 iPTLength,
00592                    bool bIsIgnored = false);
00593 
00594     bool             doesTouch(UT_sint32 iOffset, UT_sint32 iLength) const;
00595     inline UT_sint32 getOffset(void) const { return m_iOffset; }
00596     inline UT_sint32 getPTLength(void)const{ return m_iPTLength; }
00597     inline bool      getIsIgnored(void) const { return m_bIsIgnored; }
00598 
00599     inline void      setOffset(UT_sint32 iOffset) { m_iOffset = iOffset; }
00600     inline void      setPTLength(UT_sint32 iLength) { m_iPTLength = iLength; }
00601     inline void      setIsIgnored(bool bIsIgnored) { m_bIsIgnored = bIsIgnored; }
00602     void             setInvisible(void)
00603     {m_bIsInvisible = true;}
00604     bool             isInvisible(void)
00605     { return m_bIsInvisible;}
00606     void             setGrammarMessage(UT_UTF8String & sMsg);
00607     void             getGrammarMessage(UT_UTF8String & sMsg) const;
00608 
00609 private:
00610     UT_sint32   m_iOffset;
00611     UT_sint32   m_iPTLength;
00612 
00613     bool        m_bIsIgnored;
00614     bool        m_bIsInvisible;
00615     UT_UTF8String  m_sGrammarMessage;
00616 };
00617 
00618 class ABI_EXPORT fl_TabStop
00619 {
00620 public:
00621 
00622     fl_TabStop();
00623 
00624     UT_sint32       getPosition() const { return iPosition;}
00625     void            setPosition(UT_sint32 value) { iPosition = value;}
00626     eTabType        getType() { return iType;}
00627     void            setType(eTabType type) { iType = type;}
00628     eTabLeader      getLeader() { return iLeader;};
00629     void            setLeader(eTabLeader leader) { iLeader = leader;}
00630     UT_uint32       getOffset() { return iOffset;}
00631     void            setOffset(UT_uint32 value) { iOffset = value;}
00632 
00633     fl_TabStop& operator = (const fl_TabStop &Other)
00634         {
00635             iPosition = Other.iPosition;
00636             iType = Other.iType;
00637             iLeader = Other.iLeader;
00638             iOffset = Other.iOffset;
00639             return *this;
00640         }
00641 
00642 protected:
00643 
00644     UT_sint32       iPosition;
00645     eTabType        iType;
00646     eTabLeader      iLeader;
00647     UT_uint32       iOffset;
00648 };
00649 
00650 #ifdef ENABLE_SPELL
00651 class ABI_EXPORT fl_BlockSpellIterator
00652 {
00653     friend class fl_BlockLayout;
00654 
00655     UT_GrowBuf*     m_pgb;
00656 
00657     const fl_BlockLayout* m_pBL;
00658 
00659     UT_sint32       m_iWordOffset;
00660     UT_sint32       m_iWordLength;
00661 
00662     UT_sint32       m_iStartIndex;
00663     UT_sint32       m_iPrevStartIndex;
00664     UT_UCSChar*     m_pText;
00665     UT_sint32       m_iLength;
00666 
00667     UT_UCSChar*     m_pMutatedString;
00668 
00669     UT_sint32       m_iSentenceStart;
00670     UT_sint32       m_iSentenceEnd;
00671 
00672     bool            _ignoreFirstWordCharacter(const UT_UCSChar c) const;
00673     bool            _ignoreLastWordCharacter(const UT_UCSChar c) const;
00674 
00675 public:
00676     fl_BlockSpellIterator(const fl_BlockLayout* pBL, UT_sint32 iPos = 0);
00677     ~fl_BlockSpellIterator();
00678 
00679     bool            nextWordForSpellChecking(const UT_UCSChar*& pWord,
00680                                              UT_sint32& iLength,
00681                                              UT_sint32& iBlockPos,
00682                                              UT_sint32& iPTLength);
00683     void              updateBlock(void);
00684     void              updateSentenceBoundaries(void);
00685 
00686     UT_sint32         getBlockLength(void) const;
00687 
00688     void              revertToPreviousWord(void);
00689 
00690     const UT_UCSChar* getCurrentWord(UT_sint32& iLength) const;
00691     const UT_UCSChar* getPreWord(UT_sint32& iLength) const;
00692     const UT_UCSChar* getPostWord(UT_sint32& iLength) const;
00693 };
00694 #endif
00695 
00696 #endif /* FL_BLOCKLAYOUT_H */

Generated on Sun May 27 2012 for AbiWord by  doxygen 1.7.1