Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Side by Side Diff: xfa/fgas/layout/fgas_textbreak.h

Issue 1882213002: Cleanup various IFX_ text interfaces. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fgas/layout/fgas_rtfbreak.cpp ('k') | xfa/fgas/layout/fgas_textbreak.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef XFA_FGAS_LAYOUT_FGAS_TEXTBREAK_H_ 7 #ifndef XFA_FGAS_LAYOUT_FGAS_TEXTBREAK_H_
8 #define XFA_FGAS_LAYOUT_FGAS_TEXTBREAK_H_ 8 #define XFA_FGAS_LAYOUT_FGAS_TEXTBREAK_H_
9 9
10 #include "core/fxcrt/include/fx_ucd.h" 10 #include "core/fxcrt/include/fx_ucd.h"
11 #include "core/fxge/include/fx_ge.h" 11 #include "core/fxge/include/fx_ge.h"
12 #include "xfa/fgas/crt/fgas_utils.h" 12 #include "xfa/fgas/crt/fgas_utils.h"
13 #include "xfa/fgas/layout/fgas_unicode.h" 13 #include "xfa/fgas/layout/fgas_unicode.h"
14 14
15 class IFX_Font; 15 class CFX_ArabicChar;
16 class CFX_Char; 16 class CFX_Char;
17 class IFX_TxtAccess;
18 class CFX_TxtChar; 17 class CFX_TxtChar;
19 class CFX_TxtPiece; 18 class CFX_TxtPiece;
20 class IFX_TxtBreak; 19 class IFX_Font;
20 class IFX_TxtAccess;
21 21
22 #define FX_TXTBREAKPOLICY_None 0x00 22 #define FX_TXTBREAKPOLICY_None 0x00
23 #define FX_TXTBREAKPOLICY_Pagination 0x01 23 #define FX_TXTBREAKPOLICY_Pagination 0x01
24 #define FX_TXTBREAKPOLICY_SpaceBreak 0x02 24 #define FX_TXTBREAKPOLICY_SpaceBreak 0x02
25 #define FX_TXTBREAKPOLICY_NumberBreak 0x04 25 #define FX_TXTBREAKPOLICY_NumberBreak 0x04
26 #define FX_TXTBREAK_None 0x00 26 #define FX_TXTBREAK_None 0x00
27 #define FX_TXTBREAK_PieceBreak 0x01 27 #define FX_TXTBREAK_PieceBreak 0x01
28 #define FX_TXTBREAK_LineBreak 0x02 28 #define FX_TXTBREAK_LineBreak 0x02
29 #define FX_TXTBREAK_ParagraphBreak 0x03 29 #define FX_TXTBREAK_ParagraphBreak 0x03
30 #define FX_TXTBREAK_PageBreak 0x04 30 #define FX_TXTBREAK_PageBreak 0x04
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 int32_t m_iBidiLevel; 170 int32_t m_iBidiLevel;
171 int32_t m_iBidiPos; 171 int32_t m_iBidiPos;
172 int32_t m_iHorizontalScale; 172 int32_t m_iHorizontalScale;
173 int32_t m_iVerticalScale; 173 int32_t m_iVerticalScale;
174 uint32_t m_dwCharStyles; 174 uint32_t m_dwCharStyles;
175 CFX_TxtCharArray* m_pChars; 175 CFX_TxtCharArray* m_pChars;
176 void* m_pUserData; 176 void* m_pUserData;
177 }; 177 };
178 typedef CFX_BaseArrayTemplate<CFX_TxtPiece> CFX_TxtPieceArray; 178 typedef CFX_BaseArrayTemplate<CFX_TxtPiece> CFX_TxtPieceArray;
179 179
180 class IFX_TxtBreak { 180 class CFX_TxtLine {
181 public: 181 public:
182 static IFX_TxtBreak* Create(uint32_t dwPolicies); 182 CFX_TxtLine(int32_t iBlockSize)
183 virtual ~IFX_TxtBreak() {} 183 : m_iStart(0), m_iWidth(0), m_iArabicChars(0) {
184 virtual void Release() = 0; 184 m_pLineChars = new CFX_TxtCharArray;
185 virtual void SetLineWidth(FX_FLOAT fLineWidth) = 0; 185 m_pLinePieces = new CFX_TxtPieceArray(16);
186 virtual void SetLinePos(FX_FLOAT fLinePos) = 0; 186 }
187 virtual uint32_t GetLayoutStyles() const = 0; 187 ~CFX_TxtLine() {
188 virtual void SetLayoutStyles(uint32_t dwLayoutStyles) = 0; 188 RemoveAll();
189 virtual void SetFont(IFX_Font* pFont) = 0; 189 delete m_pLineChars;
190 virtual void SetFontSize(FX_FLOAT fFontSize) = 0; 190 delete m_pLinePieces;
191 virtual void SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) = 0; 191 }
192 virtual void SetDefaultChar(FX_WCHAR wch) = 0; 192 int32_t CountChars() const { return m_pLineChars->GetSize(); }
193 virtual void SetParagraphBreakChar(FX_WCHAR wch) = 0; 193 CFX_TxtChar* GetCharPtr(int32_t index) const {
194 virtual void SetLineBreakTolerance(FX_FLOAT fTolerance) = 0; 194 FXSYS_assert(index > -1 && index < m_pLineChars->GetSize());
195 virtual void SetHorizontalScale(int32_t iScale) = 0; 195 return m_pLineChars->GetDataPtr(index);
196 virtual void SetVerticalScale(int32_t iScale) = 0; 196 }
197 virtual void SetCharRotation(int32_t iCharRotation) = 0; 197 int32_t CountPieces() const { return m_pLinePieces->GetSize(); }
198 virtual void SetCharSpace(FX_FLOAT fCharSpace) = 0; 198 CFX_TxtPiece* GetPiecePtr(int32_t index) const {
199 virtual void SetAlignment(int32_t iAlignment) = 0; 199 FXSYS_assert(index > -1 && index < m_pLinePieces->GetSize());
200 virtual uint32_t GetContextCharStyles() const = 0; 200 return m_pLinePieces->GetPtrAt(index);
201 virtual void SetContextCharStyles(uint32_t dwCharStyles) = 0; 201 }
202 virtual void SetCombWidth(FX_FLOAT fCombWidth) = 0; 202 void GetString(CFX_WideString& wsStr) const {
203 virtual void SetUserData(void* pUserData) = 0; 203 int32_t iCount = m_pLineChars->GetSize();
204 virtual uint32_t AppendChar(FX_WCHAR wch) = 0; 204 FX_WCHAR* pBuf = wsStr.GetBuffer(iCount);
205 virtual uint32_t EndBreak(uint32_t dwStatus = FX_TXTBREAK_PieceBreak) = 0; 205 CFX_Char* pChar;
206 virtual int32_t CountBreakChars() const = 0; 206 for (int32_t i = 0; i < iCount; i++) {
207 virtual int32_t CountBreakPieces() const = 0; 207 pChar = m_pLineChars->GetDataPtr(i);
208 virtual const CFX_TxtPiece* GetBreakPiece(int32_t index) const = 0; 208 *pBuf++ = (FX_WCHAR)pChar->m_wCharCode;
209 virtual void ClearBreakPieces() = 0; 209 }
210 virtual void Reset() = 0; 210 wsStr.ReleaseBuffer(iCount);
211 virtual int32_t GetDisplayPos( 211 }
212 const FX_TXTRUN* pTxtRun, 212 void RemoveAll(FX_BOOL bLeaveMemory = FALSE) {
213 FXTEXT_CHARPOS* pCharPos, 213 m_pLineChars->RemoveAll();
214 FX_BOOL bCharCode = FALSE, 214 m_pLinePieces->RemoveAll(bLeaveMemory);
215 CFX_WideString* pWSForms = NULL, 215 m_iWidth = 0;
216 FX_AdjustCharDisplayPos pAdjustPos = NULL) const = 0; 216 m_iArabicChars = 0;
217 virtual int32_t GetCharRects(const FX_TXTRUN* pTxtRun, 217 }
218 CFX_RectFArray& rtArray, 218 CFX_TxtCharArray* m_pLineChars;
219 FX_BOOL bCharBBox = FALSE) const = 0; 219 CFX_TxtPieceArray* m_pLinePieces;
220 int32_t m_iStart;
221 int32_t m_iWidth;
222 int32_t m_iArabicChars;
223 };
224
225 class CFX_TxtBreak {
226 public:
227 CFX_TxtBreak(uint32_t dwPolicies);
228 ~CFX_TxtBreak();
229
230 void Release() { delete this; }
231 void SetLineWidth(FX_FLOAT fLineWidth);
232 void SetLinePos(FX_FLOAT fLinePos);
233 uint32_t GetLayoutStyles() const { return m_dwLayoutStyles; }
234 void SetLayoutStyles(uint32_t dwLayoutStyles);
235 void SetFont(IFX_Font* pFont);
236 void SetFontSize(FX_FLOAT fFontSize);
237 void SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant);
238 void SetDefaultChar(FX_WCHAR wch);
239 void SetParagraphBreakChar(FX_WCHAR wch);
240 void SetLineBreakTolerance(FX_FLOAT fTolerance);
241 void SetHorizontalScale(int32_t iScale);
242 void SetVerticalScale(int32_t iScale);
243 void SetCharRotation(int32_t iCharRotation);
244 void SetCharSpace(FX_FLOAT fCharSpace);
245 void SetAlignment(int32_t iAlignment);
246 uint32_t GetContextCharStyles() const;
247 void SetContextCharStyles(uint32_t dwCharStyles);
248 void SetCombWidth(FX_FLOAT fCombWidth);
249 void SetUserData(void* pUserData);
250 uint32_t AppendChar(FX_WCHAR wch);
251 uint32_t EndBreak(uint32_t dwStatus = FX_TXTBREAK_PieceBreak);
252 int32_t CountBreakChars() const;
253 int32_t CountBreakPieces() const;
254 const CFX_TxtPiece* GetBreakPiece(int32_t index) const;
255 void ClearBreakPieces();
256 void Reset();
257 int32_t GetDisplayPos(const FX_TXTRUN* pTxtRun,
258 FXTEXT_CHARPOS* pCharPos,
259 FX_BOOL bCharCode = FALSE,
260 CFX_WideString* pWSForms = NULL,
261 FX_AdjustCharDisplayPos pAdjustPos = NULL) const;
262 int32_t GetCharRects(const FX_TXTRUN* pTxtRun,
263 CFX_RectFArray& rtArray,
264 FX_BOOL bCharBBox = FALSE) const;
265 void AppendChar_PageLoad(CFX_Char* pCurChar, uint32_t dwProps);
266 uint32_t AppendChar_Combination(CFX_Char* pCurChar, int32_t iRotation);
267 uint32_t AppendChar_Tab(CFX_Char* pCurChar, int32_t iRotation);
268 uint32_t AppendChar_Control(CFX_Char* pCurChar, int32_t iRotation);
269 uint32_t AppendChar_Arabic(CFX_Char* pCurChar, int32_t iRotation);
270 uint32_t AppendChar_Others(CFX_Char* pCurChar, int32_t iRotation);
271
272 protected:
273 uint32_t m_dwPolicies;
274 FX_BOOL m_bPagination;
275 CFX_ArabicChar* m_pArabicChar;
276 int32_t m_iLineWidth;
277 uint32_t m_dwLayoutStyles;
278 FX_BOOL m_bVertical;
279 FX_BOOL m_bArabicContext;
280 FX_BOOL m_bArabicShapes;
281 FX_BOOL m_bRTL;
282 FX_BOOL m_bSingleLine;
283 FX_BOOL m_bCombText;
284 int32_t m_iArabicContext;
285 int32_t m_iCurArabicContext;
286 IFX_Font* m_pFont;
287 int32_t m_iFontSize;
288 FX_BOOL m_bEquidistant;
289 int32_t m_iTabWidth;
290 FX_WCHAR m_wDefChar;
291 FX_WCHAR m_wParagBreakChar;
292 int32_t m_iDefChar;
293 int32_t m_iLineRotation;
294 int32_t m_iCharRotation;
295 int32_t m_iRotation;
296 int32_t m_iAlignment;
297 uint32_t m_dwContextCharStyles;
298 int32_t m_iCombWidth;
299 void* m_pUserData;
300 uint32_t m_dwCharType;
301 FX_BOOL m_bCurRTL;
302 int32_t m_iCurAlignment;
303 FX_BOOL m_bArabicNumber;
304 FX_BOOL m_bArabicComma;
305 CFX_TxtLine* m_pTxtLine1;
306 CFX_TxtLine* m_pTxtLine2;
307 CFX_TxtLine* m_pCurLine;
308 int32_t m_iReady;
309 int32_t m_iTolerance;
310 int32_t m_iHorScale;
311 int32_t m_iVerScale;
312 int32_t m_iCharSpace;
313 void SetBreakStatus();
314 int32_t GetLineRotation(uint32_t dwStyles) const;
315 CFX_TxtChar* GetLastChar(int32_t index, FX_BOOL bOmitChar = TRUE) const;
316 CFX_TxtLine* GetTxtLine(FX_BOOL bReady) const;
317 CFX_TxtPieceArray* GetTxtPieces(FX_BOOL bReady) const;
318 uint32_t GetUnifiedCharType(uint32_t dwType) const;
319 void ResetArabicContext();
320 void ResetContextCharStyles();
321 void EndBreak_UpdateArabicShapes();
322 FX_BOOL EndBreak_SplitLine(CFX_TxtLine* pNextLine,
323 FX_BOOL bAllChars,
324 uint32_t dwStatus);
325 void EndBreak_BidiLine(CFX_TPOArray& tpos, uint32_t dwStatus);
326 void EndBreak_Alignment(CFX_TPOArray& tpos,
327 FX_BOOL bAllChars,
328 uint32_t dwStatus);
329 int32_t GetBreakPos(CFX_TxtCharArray& ca,
330 int32_t& iEndPos,
331 FX_BOOL bAllChars = FALSE,
332 FX_BOOL bOnlyBrk = FALSE);
333 void SplitTextLine(CFX_TxtLine* pCurLine,
334 CFX_TxtLine* pNextLine,
335 FX_BOOL bAllChars = FALSE);
220 }; 336 };
221 337
222 #endif // XFA_FGAS_LAYOUT_FGAS_TEXTBREAK_H_ 338 #endif // XFA_FGAS_LAYOUT_FGAS_TEXTBREAK_H_
OLDNEW
« no previous file with comments | « xfa/fgas/layout/fgas_rtfbreak.cpp ('k') | xfa/fgas/layout/fgas_textbreak.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698