• 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., 51 Franklin Street, Fifth Floor, Boston, MA
00020  * 02110-1301 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 "fl_PartOfBlock.h"
00048 #include "fb_LineBreaker.h"
00049 #include "ut_string_class.h"
00050 #include "ut_misc.h"
00051 #include "pp_PropertyMap.h"
00052 
00053 // number of DocPositions occupied by the block strux
00054 #define fl_BLOCK_STRUX_OFFSET   1
00055 
00056 class fl_Squiggles;
00057 class fl_SpellSquiggles;
00058 class fl_GrammarSquiggles;
00059 class FL_DocLayout;
00060 class fl_SectionLayout;
00061 class fl_ContainerLayout;
00062 class fb_LineBreaker;
00063 class fb_Alignment;
00064 class fp_Line;
00065 class fp_Run;
00066 class GR_Graphics;
00067 class PD_Document;
00068 class PP_Property;
00069 class PX_ChangeRecord_FmtMark;
00070 class PX_ChangeRecord_FmtMarkChange;
00071 class PX_ChangeRecord_Object;
00072 class PX_ChangeRecord_ObjectChange;
00073 class PX_ChangeRecord_Span;
00074 class PX_ChangeRecord_SpanChange;
00075 class PX_ChangeRecord_Strux;
00076 class PX_ChangeRecord_StruxChange;
00077 class pf_Frag_Strux;
00078 class pf_Frag_Object;
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     std::unique_ptr<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     void    getListAttributesVector(PP_PropertyVector & va) const;
00193     void  getListPropertyVector(PP_PropertyVector & vp) const;
00194 
00195     void  refreshRunProperties(void) const;
00196     char *  getFormatFromListType(FL_ListType iListType) const;
00197     void remItemFromList(void);
00198     virtual void listUpdate(void);
00199     void resumeList( fl_BlockLayout * prevList);
00200     void prependList( fl_BlockLayout * nextList);
00201     FL_ListType decodeListType(char * listformat) const;
00202     FL_ListType getListType(void) const;
00203     gchar* getListStyleString( FL_ListType iListType) const;
00204     FL_ListType getListTypeFromStyle( const gchar * style) const;
00205     fl_BlockLayout * getNextList(UT_uint32 id) const;
00206     bool isListLabelInBlock(void) const;
00207     void StartList( const gchar * style, pf_Frag_Strux* prevSDH = NULL);
00208 
00209     void StartList( FL_ListType lType, UT_uint32 start,
00210                     const gchar * lDelim, const gchar * lDecimal,
00211                     const gchar * fFont, float Align, float indent,
00212                     UT_uint32 iParentID = 0, UT_uint32 level=0 );
00213 
00214     void StopListInBlock(void);
00215     void deleteListLabel(void);
00216     const UT_UCSChar * getListLabel(void) const;
00217     void transferListFlags(void);
00218     UT_uint32 getLevel(void) const;
00219     void setStarting( bool bValue);
00220     void setStopping( bool bValue);
00221     fl_BlockLayout * getPreviousList(UT_uint32 id) const;
00222     fl_BlockLayout * getPreviousList(void) const;
00223     fl_BlockLayout * getPreviousListOfSameMargin(void) const;
00224     fl_BlockLayout * getParentItem(void) const;
00225 
00226 #ifdef ENABLE_SPELL
00227     void findSpellSquigglesForRun(fp_Run* pRun) const;
00228     void drawGrammarSquiggles(void) const;
00229     void findGrammarSquigglesForRun(fp_Run* pRun) const;
00230 #endif
00231 
00232     UT_uint32 canSlurp(fp_Line* pLine) const;
00233 
00234     PT_DocPosition getPosition(bool bActualBlockPos=false) const;
00235     fp_Run* findPointCoords(PT_DocPosition position, bool bEOL,
00236                             UT_sint32& x, UT_sint32& y, UT_sint32& x2,
00237                             UT_sint32& y2, UT_sint32& height, bool& bDirection) const;
00238 
00239     fp_Run* findRunAtOffset(UT_uint32 offset) const;
00240 
00241     bool    getBlockBuf(UT_GrowBuf * pgb) const;
00242 
00243     void clearScreen(GR_Graphics*) const;
00244 
00245 
00246     void                getStyle(UT_UTF8String & sStyle) const;
00247     UT_sint32           getTextIndent(void) const;
00248     inline UT_sint32    getLeftMargin(void) const { return m_iLeftMargin; }
00249     inline UT_sint32    getRightMargin(void) const { return m_iRightMargin; }
00250     inline UT_sint32    getTopMargin(void) const { return m_iTopMargin; }
00251     inline UT_sint32    getBottomMargin(void) const { return m_iBottomMargin; }
00252     inline fb_Alignment *       getAlignment(void) const { return m_pAlignment; }
00253     virtual FL_DocLayout*       getDocLayout(void) const { return m_pLayout; }
00254     virtual fl_SectionLayout*   getSectionLayout(void) const { return m_pSectionLayout;}
00255     fl_DocSectionLayout * getDocSectionLayout(void) const;
00256 
00257     void setSectionLayout(fl_SectionLayout* pSectionLayout);
00258 
00259     void getLineSpacing(double& dSpacing,
00260                         eSpacingPolicy& eSpacing) const;
00261 
00262     inline UT_uint32 getProp_Orphans(void) const { return m_iOrphansProperty; }
00263     inline UT_uint32 getProp_Widows(void) const { return m_iWidowsProperty; }
00264     inline bool getProp_KeepTogether(void) const { return m_bKeepTogether; }
00265     inline bool getProp_KeepWithNext(void) const { return m_bKeepWithNext; }
00266 
00267     inline UT_BidiCharType getDominantDirection(void) const { return m_iDomDirection; }
00268     void setDominantDirection(UT_BidiCharType iDirection);
00269 
00270 #ifdef ENABLE_SPELL
00271     inline fl_SpellSquiggles* getSpellSquiggles(void) const { return m_pSpellSquiggles; }
00272     inline fl_GrammarSquiggles* getGrammarSquiggles(void) const { return  m_pGrammarSquiggles; }
00273 #endif
00274 
00275     bool isHdrFtr(void) const;
00276     void setHdrFtr(void) { m_bIsHdrFtr = true;}
00277     void clearHdrFtr(void) { m_bIsHdrFtr = false;}
00278 
00279 #ifdef ENABLE_SPELL
00280     bool checkSpelling(void);
00281 #endif
00282     void debugFlashing(void);
00283     bool    findNextTabStop(UT_sint32 iStartX, UT_sint32 iMaxX,
00284                             UT_sint32& iPosition, eTabType& iType,
00285                             eTabLeader &iLeader ) const;
00286     bool    findPrevTabStop(UT_sint32 iStartX, UT_sint32 iMaxX,
00287                             UT_sint32& iPosition, eTabType& iType,
00288                             eTabLeader &iLeader ) const;
00289     bool    hasUpdatableField(void) { return m_bHasUpdatableField;}
00290     void    setUpdatableField(bool bValue) { m_bHasUpdatableField = bValue;}
00291     inline UT_sint32 getDefaultTabInterval(void) const { return m_iDefaultTabInterval; }
00292     inline UT_sint32 getTabsCount(void) const {
00293         return m_vecTabs.getItemCount();
00294     }
00295 
00296     bool doclistener_populateSpan(const PX_ChangeRecord_Span * pcrs, PT_BlockOffset blockOffset, UT_uint32 len);
00297     bool doclistener_populateObject(PT_BlockOffset blockOffset, const PX_ChangeRecord_Object * pcro);
00298 
00299     bool doclistener_insertSpan(const PX_ChangeRecord_Span * pcrs);
00300     bool doclistener_deleteSpan(const PX_ChangeRecord_Span * pcrs);
00301     bool doclistener_changeSpan(const PX_ChangeRecord_SpanChange * pcrsc);
00302     bool doclistener_deleteStrux(const PX_ChangeRecord_Strux * pcrx);
00303     bool doclistener_changeStrux(const PX_ChangeRecord_StruxChange * pcrxc);
00304     bool doclistener_insertFirstBlock(const PX_ChangeRecord_Strux * pcrx,
00305                                       pf_Frag_Strux* sdh,
00306                                       PL_ListenerId lid,
00307                                       void (* pfnBindHandles)(pf_Frag_Strux* sdhNew,
00308                                                               PL_ListenerId lid,
00309                                                               fl_ContainerLayout* sfhNew));
00310     bool doclistener_insertBlock(const PX_ChangeRecord_Strux * pcrx,
00311                                  pf_Frag_Strux* sdh,
00312                                  PL_ListenerId lid,
00313                                  void (* pfnBindHandles)(pf_Frag_Strux* sdhNew,
00314                                                          PL_ListenerId lid,
00315                                                          fl_ContainerLayout* sfhNew));
00316     bool doclistener_insertSection(const PX_ChangeRecord_Strux * pcrx,
00317                                    SectionType iType,
00318                                    pf_Frag_Strux* sdh,
00319                                    PL_ListenerId lid,
00320                                    void (* pfnBindHandles)(pf_Frag_Strux* sdhNew,
00321                                                            PL_ListenerId lid,
00322                                                            fl_ContainerLayout* sfhNew));
00323 
00324     fl_SectionLayout *  doclistener_insertTable(const PX_ChangeRecord_Strux * pcrx,
00325                                    SectionType iType,
00326                                    pf_Frag_Strux* sdh,
00327                                    PL_ListenerId lid,
00328                                    void (* pfnBindHandles)(pf_Frag_Strux* sdhNew,
00329                                                            PL_ListenerId lid,
00330                                                            fl_ContainerLayout* sfhNew));
00331     fl_SectionLayout *  doclistener_insertFrame(const PX_ChangeRecord_Strux * pcrx,
00332                                    SectionType iType,
00333                                    pf_Frag_Strux* sdh,
00334                                    PL_ListenerId lid,
00335                                    void (* pfnBindHandles)(pf_Frag_Strux* sdhNew,
00336                                                            PL_ListenerId lid,
00337                                                            fl_ContainerLayout* sfhNew));
00338 
00339     bool doclistener_insertObject(const PX_ChangeRecord_Object * pcro);
00340     bool doclistener_deleteObject(const PX_ChangeRecord_Object * pcro);
00341     bool doclistener_changeObject(const PX_ChangeRecord_ObjectChange * pcroc);
00342 
00343     bool doclistener_insertFmtMark(const PX_ChangeRecord_FmtMark * pcrfm);
00344     bool doclistener_deleteFmtMark(const PX_ChangeRecord_FmtMark * pcrfm);
00345     bool doclistener_changeFmtMark(const PX_ChangeRecord_FmtMarkChange * pcrfmc);
00346 
00347     void                    purgeLayout(void);
00348     virtual void            collapse(void);
00349     virtual bool            isCollapsed(void) const
00350         {return m_bIsCollapsed;}
00351     void                    coalesceRuns(void) const;
00352     virtual void            setNeedsReformat(fl_ContainerLayout * pCL, UT_uint32 offset = 0);
00353     inline bool             needsReformat(void) const
00354         { return (m_iNeedsReformat >= 0); }
00355     virtual void            setNeedsRedraw(void);
00356     virtual bool            needsRedraw(void) const
00357         { return m_bNeedsRedraw; }
00358     virtual void            markAllRunsDirty(void);
00359     UT_sint32               findLineInBlock(fp_Line * pLine) const;
00360 
00361     bool                    isWordDelimiter(UT_UCS4Char c, UT_UCS4Char next, UT_UCS4Char prev, UT_uint32 iBlockPos) const;
00362     bool                    isSentenceSeparator(UT_UCS4Char c, UT_uint32 iBlockPos) const;
00363 #ifdef ENABLE_SPELL
00364     bool                    checkWord(const fl_PartOfBlockPtr& pPOB) const;
00365     void                    recheckIgnoredWords();
00366 #endif
00367     void                    setStyleInTOC(bool b)
00368     {   m_bStyleInTOC = b;}
00369     void                    forceSectionBreak(void);
00370     bool                    isContainedByTOC(void) const
00371         { return m_bIsTOC;}
00372     FootnoteType            getTOCNumType(void) const;
00373     eTabLeader              getTOCTabLeader(UT_sint32 iOff) const;
00374     UT_sint32               getTOCTabPosition(UT_sint32 iOff) const;
00375     void                    setAccumHeight(UT_sint32 i)
00376     { m_iAccumulatedHeight =i;}
00377     UT_sint32               getAccumHeight(void) const
00378     { return m_iAccumulatedHeight;}
00379     static bool         s_EnumTabStops(void * myThis, UT_uint32 k, fl_TabStop *pTabInfo);
00380 
00381     inline void         addBackgroundCheckReason(UT_uint32 reason) {m_uBackgroundCheckReasons |= reason;}
00382     inline void         removeBackgroundCheckReason(UT_uint32 reason) {m_uBackgroundCheckReasons &= ~reason;}
00383     inline bool     hasBackgroundCheckReason(UT_uint32 reason) const {return ((m_uBackgroundCheckReasons & reason) ? true : false);}
00384 
00385     // The following is a set of bit flags giving the reason this block is
00386     // queued for background checking.  See specific values in fl_DocLayout.h
00387     UT_uint32               m_uBackgroundCheckReasons;
00388     void                    setPrevListLabel(bool b)
00389     { m_bPrevListLabel = b;}
00390     bool                    getNextTableElement(UT_GrowBuf * buf,
00391                                                 PT_DocPosition startPos,
00392                                                 PT_DocPosition & begPos,
00393                                                 PT_DocPosition & endPos,
00394                                                 UT_UTF8String & sWord,
00395                                                 UT_uint32 iDelim) const;
00396     bool                   itemizeSpan(PT_BlockOffset blockOffset, UT_uint32 len,GR_Itemization & I);
00397     const UT_RGBColor      getShadingingForeColor(void) const;
00398     const UT_RGBColor      getShadingingBackColor(void) const;
00399     UT_sint32              getPattern(void) const;
00400 
00401     const PP_PropertyMap::Line & getBottom () const { return m_lineBottom; }
00402     const PP_PropertyMap::Line & getLeft ()   const { return m_lineLeft; }
00403     const PP_PropertyMap::Line & getRight ()  const { return m_lineRight; }
00404     const PP_PropertyMap::Line & getTop ()    const { return m_lineTop; }
00405 
00406     bool                   hasBorders(void) const;
00407     bool                   canMergeBordersWithPrev(void) const;
00408     bool                   canMergeBordersWithNext(void) const;
00409     void                   setLineHeightBlockWithBorders(int whichLine = 0);
00410 
00411 #ifdef ENABLE_SPELL
00412 
00413     void enqueueToSpellCheckAfter(fl_BlockLayout *prev);
00415     void dequeueFromSpellCheck(void);
00417     void clearQueueing(void)
00418     {
00419         m_prevToSpell = m_nextToSpell = NULL;
00420     }
00421     fl_BlockLayout *nextToSpell(void) const
00422     {
00423         return m_nextToSpell;
00424     }
00426     bool isQueued(void) const
00427     {
00428         return (m_prevToSpell != NULL)
00429             || (m_pLayout->spellQueueHead() == this);
00430     }
00431 #endif
00432 
00433 #ifdef FMT_TEST
00434     void                    __dump(FILE * fp) const;
00435 #endif
00436 
00437 private:
00438     virtual bool            _canContainPoint() const;
00439 
00440 protected:
00441 
00442     void                    _recalcPendingWord(UT_uint32 iOffset, UT_sint32 chg) const;
00443     bool                    _doCheckWord(const fl_PartOfBlockPtr& pPOB,
00444                                          const UT_UCSChar* pBlockText,
00445                                          UT_sint32 iLength,
00446                                          bool bAddSquiggle = true,
00447                                          bool bClearScreen = true) const;
00448 
00449 #ifdef ENABLE_SPELL
00450     bool                    _spellCheckWord(const UT_UCSChar * word, UT_uint32 len, UT_uint32 blockPos) const;
00451     SpellChecker * _getSpellChecker (UT_uint32 blockPos) const;
00452 #endif
00453 
00454     bool                    _truncateLayout(fp_Run* pTruncRun);
00455 
00456 #ifndef NDEBUG
00457     void                    _assertRunListIntegrityImpl(void) const;
00458 #endif
00459     void                        _assertRunListIntegrity(void) const;
00460 
00461     void                    _mergeRuns(fp_Run* pFirstRunToMerge, fp_Run* pLastRunToMerge) const;
00462 
00463     bool                    _doInsertRun(fp_Run* pNewRun);
00464     bool                    _delete(PT_BlockOffset blockOffset, UT_uint32 len);
00465     bool                    _doInsertTextSpan(PT_BlockOffset blockOffset, UT_uint32 len);
00466     bool                    _doInsertForcedLineBreakRun(PT_BlockOffset blockOffset);
00467     bool                    _doInsertFieldStartRun(PT_BlockOffset blockOffset);
00468     bool                    _doInsertFieldEndRun(PT_BlockOffset blockOffset);
00469     bool                    _doInsertBookmarkRun(PT_BlockOffset blockOffset);
00470     bool                    _doInsertHyperlinkRun(PT_BlockOffset blockOffset);
00471     bool                    _doInsertAnnotationRun(PT_BlockOffset blockOffset);
00472     bool                    _doInsertRDFAnchorRun(PT_BlockOffset blockOffset);
00473     void                    _finishInsertHyperlinkedNewRun( PT_BlockOffset blockOffset, fp_HyperlinkRun* pNewRun );
00474     bool                    _doInsertMathRun(PT_BlockOffset blockOffset,PT_AttrPropIndex indexAP,pf_Frag_Object* oh);
00475     bool                    _doInsertEmbedRun(PT_BlockOffset blockOffset,PT_AttrPropIndex indexAP,pf_Frag_Object* oh);
00476 //  bool                    _deleteBookmarkRun(PT_BlockOffset blockOffset);
00477     bool                    _doInsertForcedColumnBreakRun(PT_BlockOffset blockOffset);
00478     bool                    _doInsertForcedPageBreakRun(PT_BlockOffset blockOffset);
00479     bool                    _doInsertTabRun(PT_BlockOffset blockOffset);
00480     bool                    _doInsertTOCTabRun(PT_BlockOffset blockOffset);
00481     bool                    _doInsertTOCListLabelRun(PT_BlockOffset blockOffset);
00482     bool                    _doInsertTOCHeadingRun(PT_BlockOffset blockOffset);
00483     bool                    _doInsertTOCListTabRun(PT_BlockOffset blockOffset);
00484     bool                    _doInsertImageRun(PT_BlockOffset blockOffset, FG_GraphicPtr && pFG, pf_Frag_Object* oh);
00485     bool                    _doInsertFieldRun(PT_BlockOffset blockOffset, const PX_ChangeRecord_Object * pcro);
00486     bool                    _doInsertFieldTOCRun(PT_BlockOffset blockOffset);
00487     bool                    _doInsertDirectionMarkerRun(PT_BlockOffset blockOffset, UT_UCS4Char iM);
00488     bool                    _deleteFmtMark(PT_BlockOffset blockOffset);
00489 
00490     virtual void            _lookupProperties(const PP_AttrProp* pAP);
00491     virtual void            _lookupMarginProperties(const PP_AttrProp* pAP);
00492     void                    _removeLine(fp_Line*, bool bRemoveFromContainer, bool bReCalc);
00493     void                    _purgeLine(fp_Line*);
00494     void                    _removeAllEmptyLines(void);
00495 
00496     bool                    _checkMultiWord(UT_sint32 iStart,
00497                                             UT_sint32 eor,
00498                                             bool bToggleIP) const;
00499 
00500     UT_uint32               _getLastChar();
00501     void                    _stuffAllRunsOnALine(void);
00502     void                    _insertEndOfParagraphRun(void);
00503     void                    _purgeEndOfParagraphRun(void);
00504     void                    _breakLineAfterRun(fp_Run* /*pRun*/);
00505 
00506     static void             _prefsListener(XAP_Prefs *pPrefs, UT_StringPtrMap * /*phChanges*/, void * data);
00507 
00508     void                    _createListLabel(void);
00509     void                    _deleteListLabel(void);
00510     inline void             _addBlockToPrevList( fl_BlockLayout * prevBlockInList, UT_uint32 level);
00511     inline void             _prependBlockToPrevList( fl_BlockLayout * nextBlockInList);
00512     UT_sint32               m_iNeedsReformat; // will store offset
00513                                               // from which reformat
00514                                               // is need, -1 if not
00515     bool                    m_bNeedsRedraw;
00516     bool                    m_bIsHdrFtr;
00517 
00518     FL_DocLayout*           m_pLayout;
00519     fb_LineBreaker          m_Breaker;
00520 
00521     fp_Run*                 m_pFirstRun;
00522     fl_SectionLayout*       m_pSectionLayout;
00523 
00524     UT_GenericVector<fl_TabStop*>   m_vecTabs;
00525     UT_sint32               m_iDefaultTabInterval;
00526     // read-only caches of the underlying properties
00527     UT_uint32               m_iOrphansProperty;
00528     UT_uint32               m_iWidowsProperty;
00529     UT_sint32               m_iTopMargin;
00530     UT_sint32               m_iBottomMargin;
00531     UT_sint32               m_iLeftMargin;
00532     UT_sint32               m_iRightMargin;
00533     UT_sint32               m_iTextIndent;
00534     fb_Alignment *          m_pAlignment;
00535     double                  m_dLineSpacing;
00536     //bool                  m_bExactSpacing;
00537     eSpacingPolicy          m_eSpacingPolicy;
00538     bool                    m_bKeepTogether;
00539     bool                    m_bKeepWithNext;
00540 
00541     bool                    m_bStartList;
00542     bool                    m_bStopList;
00543     bool                    m_bListLabelCreated;
00544 #ifdef ENABLE_SPELL
00545     fl_SpellSquiggles *     m_pSpellSquiggles;
00546     fl_GrammarSquiggles *   m_pGrammarSquiggles;
00547     fl_BlockLayout          *m_nextToSpell;
00548     fl_BlockLayout          *m_prevToSpell;
00549 #endif
00550     bool                    m_bListItem;
00551     const gchar *       m_szStyle;
00552     bool                    m_bIsCollapsed;
00553     bool                    m_bHasUpdatableField;
00554 
00555     UT_BidiCharType         m_iDomDirection;
00556     UT_BidiCharType         m_iDirOverride;
00557 
00558     bool                    m_bIsTOC;
00559     bool                    m_bStyleInTOC;
00560     UT_sint32               m_iTOCLevel;
00561 
00562     bool                    m_bSameYAsPrevious;
00563     UT_sint32               m_iAccumulatedHeight;
00564     fp_VerticalContainer *  m_pVertContainer;
00565     UT_sint32               m_iLinePosInContainer;
00566     bool                    m_bForceSectionBreak;
00567     bool                    m_bPrevListLabel;
00568     UT_sint32               m_iAdditionalMarginAfter;
00569     UT_RGBColor             m_ShadingForeColor;
00570     UT_RGBColor             m_ShadingBackColor;
00571     UT_sint32               m_iPattern;
00572 
00573     PP_PropertyMap::Line    m_lineBottom;
00574     PP_PropertyMap::Line    m_lineLeft;
00575     PP_PropertyMap::Line    m_lineRight;
00576     PP_PropertyMap::Line    m_lineTop;
00577     bool                    m_bCanMergeBordersWithNext;
00578     bool                    m_bHasBorders;
00579 };
00580 
00581 class ABI_EXPORT fl_TabStop
00582 {
00583 public:
00584 
00585     fl_TabStop();
00586 
00587     UT_sint32       getPosition() const { return iPosition;}
00588     void            setPosition(UT_sint32 value) { iPosition = value;}
00589     eTabType        getType() { return iType;}
00590     void            setType(eTabType type) { iType = type;}
00591     eTabLeader      getLeader() { return iLeader;};
00592     void            setLeader(eTabLeader leader) { iLeader = leader;}
00593     UT_uint32       getOffset() { return iOffset;}
00594     void            setOffset(UT_uint32 value) { iOffset = value;}
00595 
00596     fl_TabStop& operator = (const fl_TabStop &Other)
00597         {
00598             iPosition = Other.iPosition;
00599             iType = Other.iType;
00600             iLeader = Other.iLeader;
00601             iOffset = Other.iOffset;
00602             return *this;
00603         }
00604 
00605 protected:
00606 
00607     UT_sint32       iPosition;
00608     eTabType        iType;
00609     eTabLeader      iLeader;
00610     UT_uint32       iOffset;
00611 };
00612 
00613 #ifdef ENABLE_SPELL
00614 class ABI_EXPORT fl_BlockSpellIterator
00615 {
00616     friend class fl_BlockLayout;
00617 
00618     UT_GrowBuf*     m_pgb;
00619 
00620     const fl_BlockLayout* m_pBL;
00621 
00622     UT_sint32       m_iWordOffset;
00623     UT_sint32       m_iWordLength;
00624 
00625     UT_sint32       m_iStartIndex;
00626     UT_sint32       m_iPrevStartIndex;
00627     UT_UCSChar*     m_pText;
00628     UT_sint32       m_iLength;
00629 
00630     UT_UCSChar*     m_pMutatedString;
00631 
00632     UT_sint32       m_iSentenceStart;
00633     UT_sint32       m_iSentenceEnd;
00634 
00635     bool            _ignoreFirstWordCharacter(const UT_UCSChar c) const;
00636     bool            _ignoreLastWordCharacter(const UT_UCSChar c) const;
00637 
00638 public:
00639     fl_BlockSpellIterator(const fl_BlockLayout* pBL, UT_sint32 iPos = 0);
00640     ~fl_BlockSpellIterator();
00641 
00642     bool            nextWordForSpellChecking(const UT_UCSChar*& pWord,
00643                                              UT_sint32& iLength,
00644                                              UT_sint32& iBlockPos,
00645                                              UT_sint32& iPTLength);
00646     void              updateBlock(void);
00647     void              updateSentenceBoundaries(void);
00648 
00649     UT_sint32         getBlockLength(void) const;
00650 
00651     void              revertToPreviousWord(void);
00652 
00653     const UT_UCSChar* getCurrentWord(UT_sint32& iLength) const;
00654     const UT_UCSChar* getPreWord(UT_sint32& iLength) const;
00655     const UT_UCSChar* getPostWord(UT_sint32& iLength) const;
00656 };
00657 #endif
00658 
00659 #endif /* FL_BLOCKLAYOUT_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1