00001 /* AbiWord 00002 * Copyright (C) 1998,1999 AbiSource, Inc. 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00017 * 02110-1301 USA. 00018 */ 00019 00020 00021 00022 #ifndef FB_LINEBREAKER_H 00023 #define FB_LINEBREAKER_H 00024 00025 #include "ut_types.h" 00026 00027 class fl_BlockLayout; 00028 class fp_Line; 00029 class fp_Run; 00030 class fp_Page; 00031 struct fp_RunSplitInfo; 00032 00033 /* 00034 fb_LineBreaker encapsulates knowledge of how to break runs across lines. 00035 It also breaks them between words, to help with later justification. 00036 */ 00037 class ABI_EXPORT fb_LineBreaker 00038 { 00039 public: 00040 fb_LineBreaker(); 00041 virtual ~fb_LineBreaker(void); 00042 UT_sint32 breakParagraph(fl_BlockLayout*, fp_Line * pLineToStartAt, fp_Page * pPage); 00043 00044 protected: 00045 void _breakTheLineAtLastRunToKeep(fp_Line *pLine, fl_BlockLayout *pBlock,fp_Page * pPage); 00046 UT_sint32 _moveBackToFirstNonBlankData(fp_Run *pCurrentRun, fp_Run **pOffendingRun); 00047 bool _splitAtOrBeforeThisRun(fp_Run *pCurrentRun, UT_sint32 iTrailSpace); 00048 bool _splitAtNextNonBlank(fp_Run *pCurrentRun); 00049 void _splitRunAt(fp_Run *pCurrentRun, fp_RunSplitInfo &splitInfo); 00050 00051 private: 00052 fp_Run* m_pFirstRunToKeep; 00053 fp_Run* m_pLastRunToKeep; 00054 00055 UT_sint32 m_iMaxLineWidth; 00056 UT_sint32 m_iWorkingLineWidth; 00057 }; 00058 00059 #endif /* FB_LINEBREAKER_H */