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

Side by Side Diff: xfa/src/fee/fde_txtedtpage.h

Issue 1803723002: Move xfa/src up to xfa/. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 9 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/src/fee/fde_txtedtengine.cpp ('k') | xfa/src/fee/fde_txtedtpage.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #ifndef XFA_SRC_FEE_FDE_TXTEDTPAGE_H_
8 #define XFA_SRC_FEE_FDE_TXTEDTPAGE_H_
9
10 #include "core/include/fxcrt/fx_coordinates.h"
11 #include "core/include/fxcrt/fx_string.h"
12 #include "xfa/src/fde/fde_visualset.h"
13 #include "xfa/src/fee/ifde_txtedtpage.h"
14 #include "xfa/src/fgas/crt/fgas_utils.h"
15
16 class IFX_CharIter;
17 class CFDE_TxtEdtEngine;
18 class CFDE_TxtEdtPage;
19 class CFDE_TxtEdtParag;
20
21 enum FDE_TXTEDT_CHARTYPE {
22 FDE_TXTEDT_CHARTYPE_Unknown = 0,
23 FDE_TXTEDT_CHARTYPE_Tab,
24 FDE_TXTEDT_CHARTYPE_Space,
25 FDE_TXTEDT_CHARTYPE_Punctuation,
26 FDE_TXTEDT_CHARTYPE_LineBreak,
27 FDE_TXTEDT_CHARTYPE_Number,
28 FDE_TXTEDT_CHARTYPE_Char,
29 FDE_TXTEDT_CHARTYPE_CJK,
30 };
31
32 inline FDE_TXTEDT_CHARTYPE FDE_GetEditSelCharType(FX_WCHAR wChar) {
33 if (wChar == 0x9) {
34 return FDE_TXTEDT_CHARTYPE_Tab;
35 } else if (wChar == 0x20 || wChar == 0xA0) {
36 return FDE_TXTEDT_CHARTYPE_Space;
37 } else if (wChar == 0x9 || wChar == 0x20 || wChar == 0xA0 ||
38 (wChar >= L'!' && wChar <= L'/') ||
39 (wChar >= L':' && wChar <= L'@') ||
40 (wChar >= L'[' && wChar <= L'^') ||
41 (wChar >= L'{' && wChar <= L'~') || wChar == 0x60) {
42 return FDE_TXTEDT_CHARTYPE_Punctuation;
43 } else if (wChar == 0x0a || wChar == 0x0d) {
44 return FDE_TXTEDT_CHARTYPE_LineBreak;
45 } else if (wChar >= '0' && wChar <= '9') {
46 return FDE_TXTEDT_CHARTYPE_Number;
47 } else if ((wChar >= 0x2e80 && wChar <= 0x2eff) ||
48 (wChar >= 0x3000 && wChar <= 0x303f) ||
49 (wChar >= 0x31c0 && wChar <= 0x31ef) ||
50 (wChar >= 0x3200 && wChar <= 0x32ff) ||
51 (wChar >= 0x3300 && wChar <= 0x33ff) ||
52 (wChar >= 0x3400 && wChar <= 0x4dbf) ||
53 (wChar >= 0x4e00 && wChar <= 0x9fff) ||
54 (wChar >= 0xf900 && wChar <= 0xfaff) ||
55 (wChar >= 0xfe30 && wChar <= 0xfe4f)) {
56 return FDE_TXTEDT_CHARTYPE_CJK;
57 } else {
58 return FDE_TXTEDT_CHARTYPE_Char;
59 }
60 }
61
62 struct FDE_TEXTEDITPIECE {
63 int32_t nStart;
64 int32_t nCount;
65 int32_t nBidiLevel;
66 CFX_RectF rtPiece;
67 FX_DWORD dwCharStyles;
68 };
69 typedef CFX_MassArrayTemplate<FDE_TEXTEDITPIECE> CFDE_TXTEDTPieceMassArray;
70
71 class CFDE_TxtEdtTextSet : public IFDE_TextSet {
72 public:
73 CFDE_TxtEdtTextSet(CFDE_TxtEdtPage* pPage);
74 ~CFDE_TxtEdtTextSet();
75
76 virtual FDE_VISUALOBJTYPE GetType();
77 virtual FX_BOOL GetBBox(FDE_HVISUALOBJ hVisualObj, CFX_RectF& bbox);
78 virtual FX_BOOL GetMatrix(FDE_HVISUALOBJ hVisualObj, CFX_Matrix& matrix);
79 virtual FX_BOOL GetRect(FDE_HVISUALOBJ hVisualObj, CFX_RectF& rt);
80 virtual FX_BOOL GetClip(FDE_HVISUALOBJ hVisualObj, CFX_RectF& rt);
81 virtual int32_t GetString(FDE_HVISUALOBJ hText, CFX_WideString& wsText);
82 virtual IFX_Font* GetFont(FDE_HVISUALOBJ hText);
83 virtual FX_FLOAT GetFontSize(FDE_HVISUALOBJ hText);
84 virtual FX_ARGB GetFontColor(FDE_HVISUALOBJ hText);
85 virtual int32_t GetDisplayPos(FDE_HVISUALOBJ hText,
86 FXTEXT_CHARPOS* pCharPos,
87 FX_BOOL bCharCode = FALSE,
88 CFX_WideString* pWSForms = NULL);
89 virtual int32_t GetCharRects(FDE_HVISUALOBJ hText, CFX_RectFArray& rtArray);
90 virtual int32_t GetCharRects_Impl(FDE_HVISUALOBJ hText,
91 CFX_RectFArray& rtArray,
92 FX_BOOL bBBox = FALSE);
93
94 private:
95 CFDE_TxtEdtPage* m_pPage;
96 };
97
98 class CFDE_TxtEdtPage : public IFDE_TxtEdtPage {
99 public:
100 CFDE_TxtEdtPage(IFDE_TxtEdtEngine* pEngine, int32_t nLineIndex);
101
102 // IFDE_TxtEditPage:
103 void Release() override;
104 IFDE_TxtEdtEngine* GetEngine() const override;
105 int32_t GetCharRect(int32_t nIndex,
106 CFX_RectF& rect,
107 FX_BOOL bBBox = FALSE) const override;
108 int32_t GetCharIndex(const CFX_PointF& fPoint, FX_BOOL& bBefore) override;
109 void CalcRangeRectArray(int32_t nStart,
110 int32_t nCount,
111 CFX_RectFArray& RectFArr) const override;
112 int32_t SelectWord(const CFX_PointF& fPoint, int32_t& nCount) override;
113 int32_t GetCharStart() const override;
114 int32_t GetCharCount() const override;
115 int32_t GetDisplayPos(const CFX_RectF& rtClip,
116 FXTEXT_CHARPOS*& pCharPos,
117 CFX_RectF* pBBox) const override;
118 FX_BOOL IsLoaded(const CFX_RectF* pClipBox) override;
119 int32_t LoadPage(const CFX_RectF* pClipBox, IFX_Pause* pPause) override;
120 void UnloadPage(const CFX_RectF* pClipBox) override;
121 const CFX_RectF& GetContentsBox() override;
122
123 // IFDE_VisualSet:
124 FDE_VISUALOBJTYPE GetType() override;
125 FX_BOOL GetBBox(FDE_HVISUALOBJ hVisualObj, CFX_RectF& bbox) override;
126 FX_BOOL GetMatrix(FDE_HVISUALOBJ hVisualObj, CFX_Matrix& matrix) override;
127 FX_BOOL GetRect(FDE_HVISUALOBJ hVisualObj, CFX_RectF& rt) override;
128 FX_BOOL GetClip(FDE_HVISUALOBJ hVisualObj, CFX_RectF& rt) override;
129
130 // IFDE_CanvasSet:
131 FX_POSITION GetFirstPosition(FDE_HVISUALOBJ hCanvas) override;
132 FDE_HVISUALOBJ GetNext(FDE_HVISUALOBJ hCanvas,
133 FX_POSITION& pos,
134 IFDE_VisualSet*& pVisualSet) override;
135 FDE_HVISUALOBJ GetParentCanvas(FDE_HVISUALOBJ hCanvas,
136 IFDE_VisualSet*& pVisualSet) override;
137
138 // IFX_TxtAccess:
139 FX_WCHAR GetChar(void* pIdentity, int32_t index) const override;
140 int32_t GetWidth(void* pIdentity, int32_t index) const override;
141
142 protected:
143 virtual ~CFDE_TxtEdtPage();
144
145 private:
146 void NormalizePt2Rect(CFX_PointF& ptF,
147 const CFX_RectF& rtF,
148 FX_FLOAT fTolerance) const;
149
150 IFX_CharIter* m_pIter;
151 CFDE_TxtEdtTextSet* m_pTextSet;
152 CFDE_TxtEdtEngine* m_pEditEngine;
153 CFDE_TXTEDTPieceMassArray m_PieceMassArr;
154 CFDE_TxtEdtParag* m_pBgnParag;
155 CFDE_TxtEdtParag* m_pEndParag;
156 int32_t m_nRefCount;
157 int32_t m_nPageStart;
158 int32_t m_nCharCount;
159 int32_t m_nPageIndex;
160 FX_BOOL m_bLoaded;
161 CFX_RectF m_rtPage;
162 CFX_RectF m_rtPageMargin;
163 CFX_RectF m_rtPageContents;
164 CFX_RectF m_rtPageCanvas;
165 int32_t* m_pCharWidth;
166 };
167
168 #endif // XFA_SRC_FEE_FDE_TXTEDTPAGE_H_
OLDNEW
« no previous file with comments | « xfa/src/fee/fde_txtedtengine.cpp ('k') | xfa/src/fee/fde_txtedtpage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698