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