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

Side by Side Diff: fpdfsdk/src/fxedit/fxet_pageobjs.cpp

Issue 1737593006: Re-land "Replace CPDF_Rect and CPDF_Point with CFX types." (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Ooops. 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 | « fpdfsdk/src/fxedit/fxet_list.cpp ('k') | fpdfsdk/src/javascript/Document.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 #include "core/include/fpdfapi/fpdf_pageobj.h" 7 #include "core/include/fpdfapi/fpdf_pageobj.h"
8 #include "core/include/fpdfapi/fpdf_render.h" 8 #include "core/include/fpdfapi/fpdf_render.h"
9 #include "fpdfsdk/include/fx_systemhandler.h" 9 #include "fpdfsdk/include/fx_systemhandler.h"
10 #include "fpdfsdk/include/fxedit/fx_edit.h" 10 #include "fpdfsdk/include/fxedit/fx_edit.h"
11 #include "fpdfsdk/include/fxedit/fxet_edit.h" 11 #include "fpdfsdk/include/fxedit/fxet_edit.h"
12 12
13 #define FX_EDIT_UNDERLINEHALFWIDTH 0.5f 13 #define FX_EDIT_UNDERLINEHALFWIDTH 0.5f
14 #define FX_EDIT_CROSSOUTHALFWIDTH 0.5f 14 #define FX_EDIT_CROSSOUTHALFWIDTH 0.5f
15 15
16 CPDF_Rect GetUnderLineRect(const CPVT_Word& word) { 16 CFX_FloatRect GetUnderLineRect(const CPVT_Word& word) {
17 return CPDF_Rect(word.ptWord.x, word.ptWord.y + word.fDescent * 0.5f, 17 return CFX_FloatRect(word.ptWord.x, word.ptWord.y + word.fDescent * 0.5f,
18 word.ptWord.x + word.fWidth, 18 word.ptWord.x + word.fWidth,
19 word.ptWord.y + word.fDescent * 0.25f); 19 word.ptWord.y + word.fDescent * 0.25f);
20 } 20 }
21 21
22 CPDF_Rect GetCrossoutRect(const CPVT_Word& word) { 22 CFX_FloatRect GetCrossoutRect(const CPVT_Word& word) {
23 return CPDF_Rect(word.ptWord.x, 23 return CFX_FloatRect(word.ptWord.x,
24 word.ptWord.y + (word.fAscent + word.fDescent) * 0.5f + 24 word.ptWord.y + (word.fAscent + word.fDescent) * 0.5f +
25 word.fDescent * 0.25f, 25 word.fDescent * 0.25f,
26 word.ptWord.x + word.fWidth, 26 word.ptWord.x + word.fWidth,
27 word.ptWord.y + (word.fAscent + word.fDescent) * 0.5f); 27 word.ptWord.y + (word.fAscent + word.fDescent) * 0.5f);
28 } 28 }
29 29
30 static void DrawTextString(CFX_RenderDevice* pDevice, 30 static void DrawTextString(CFX_RenderDevice* pDevice,
31 const CPDF_Point& pt, 31 const CFX_FloatPoint& pt,
32 CPDF_Font* pFont, 32 CPDF_Font* pFont,
33 FX_FLOAT fFontSize, 33 FX_FLOAT fFontSize,
34 CFX_Matrix* pUser2Device, 34 CFX_Matrix* pUser2Device,
35 const CFX_ByteString& str, 35 const CFX_ByteString& str,
36 FX_ARGB crTextFill, 36 FX_ARGB crTextFill,
37 FX_ARGB crTextStroke, 37 FX_ARGB crTextStroke,
38 int32_t nHorzScale) { 38 int32_t nHorzScale) {
39 FX_FLOAT x = pt.x, y = pt.y; 39 FX_FLOAT x = pt.x, y = pt.y;
40 pUser2Device->Transform(x, y); 40 pUser2Device->Transform(x, y);
41 41
42 if (pFont) { 42 if (pFont) {
43 if (nHorzScale != 100) { 43 if (nHorzScale != 100) {
44 CFX_Matrix mt(nHorzScale / 100.0f, 0, 0, 1, 0, 0); 44 CFX_Matrix mt(nHorzScale / 100.0f, 0, 0, 1, 0, 0);
45 mt.Concat(*pUser2Device); 45 mt.Concat(*pUser2Device);
46 46
47 CPDF_RenderOptions ro; 47 CPDF_RenderOptions ro;
48 ro.m_Flags = RENDER_CLEARTYPE; 48 ro.m_Flags = RENDER_CLEARTYPE;
49 ro.m_ColorMode = RENDER_COLOR_NORMAL; 49 ro.m_ColorMode = RENDER_COLOR_NORMAL;
50 50
51 if (crTextStroke != 0) { 51 if (crTextStroke != 0) {
52 CPDF_Point pt1(0, 0), pt2(1, 0); 52 CFX_FloatPoint pt1(0, 0), pt2(1, 0);
53 pUser2Device->Transform(pt1.x, pt1.y); 53 pUser2Device->Transform(pt1.x, pt1.y);
54 pUser2Device->Transform(pt2.x, pt2.y); 54 pUser2Device->Transform(pt2.x, pt2.y);
55 CFX_GraphStateData gsd; 55 CFX_GraphStateData gsd;
56 gsd.m_LineWidth = 56 gsd.m_LineWidth =
57 (FX_FLOAT)FXSYS_fabs((pt2.x + pt2.y) - (pt1.x + pt1.y)); 57 (FX_FLOAT)FXSYS_fabs((pt2.x + pt2.y) - (pt1.x + pt1.y));
58 58
59 CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize, &mt, 59 CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize, &mt,
60 str, crTextFill, crTextStroke, &gsd, 60 str, crTextFill, crTextStroke, &gsd,
61 &ro); 61 &ro);
62 } else { 62 } else {
63 CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize, &mt, 63 CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize, &mt,
64 str, crTextFill, 0, NULL, &ro); 64 str, crTextFill, 0, NULL, &ro);
65 } 65 }
66 } else { 66 } else {
67 CPDF_RenderOptions ro; 67 CPDF_RenderOptions ro;
68 ro.m_Flags = RENDER_CLEARTYPE; 68 ro.m_Flags = RENDER_CLEARTYPE;
69 ro.m_ColorMode = RENDER_COLOR_NORMAL; 69 ro.m_ColorMode = RENDER_COLOR_NORMAL;
70 70
71 if (crTextStroke != 0) { 71 if (crTextStroke != 0) {
72 CPDF_Point pt1(0, 0), pt2(1, 0); 72 CFX_FloatPoint pt1(0, 0), pt2(1, 0);
73 pUser2Device->Transform(pt1.x, pt1.y); 73 pUser2Device->Transform(pt1.x, pt1.y);
74 pUser2Device->Transform(pt2.x, pt2.y); 74 pUser2Device->Transform(pt2.x, pt2.y);
75 CFX_GraphStateData gsd; 75 CFX_GraphStateData gsd;
76 gsd.m_LineWidth = 76 gsd.m_LineWidth =
77 (FX_FLOAT)FXSYS_fabs((pt2.x + pt2.y) - (pt1.x + pt1.y)); 77 (FX_FLOAT)FXSYS_fabs((pt2.x + pt2.y) - (pt1.x + pt1.y));
78 78
79 CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize, 79 CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize,
80 pUser2Device, str, crTextFill, 80 pUser2Device, str, crTextFill,
81 crTextStroke, &gsd, &ro); 81 crTextStroke, &gsd, &ro);
82 } else { 82 } else {
83 CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize, 83 CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize,
84 pUser2Device, str, crTextFill, 0, 84 pUser2Device, str, crTextFill, 0,
85 NULL, &ro); 85 NULL, &ro);
86 } 86 }
87 } 87 }
88 } 88 }
89 } 89 }
90 90
91 void IFX_Edit::DrawUnderline(CFX_RenderDevice* pDevice, 91 void IFX_Edit::DrawUnderline(CFX_RenderDevice* pDevice,
92 CFX_Matrix* pUser2Device, 92 CFX_Matrix* pUser2Device,
93 IFX_Edit* pEdit, 93 IFX_Edit* pEdit,
94 FX_COLORREF color, 94 FX_COLORREF color,
95 const CPDF_Rect& rcClip, 95 const CFX_FloatRect& rcClip,
96 const CPDF_Point& ptOffset, 96 const CFX_FloatPoint& ptOffset,
97 const CPVT_WordRange* pRange) { 97 const CPVT_WordRange* pRange) {
98 pDevice->SaveState(); 98 pDevice->SaveState();
99 99
100 if (!rcClip.IsEmpty()) { 100 if (!rcClip.IsEmpty()) {
101 CPDF_Rect rcTemp = rcClip; 101 CFX_FloatRect rcTemp = rcClip;
102 pUser2Device->TransformRect(rcTemp); 102 pUser2Device->TransformRect(rcTemp);
103 FX_RECT rcDevClip; 103 FX_RECT rcDevClip;
104 rcDevClip.left = (int32_t)rcTemp.left; 104 rcDevClip.left = (int32_t)rcTemp.left;
105 rcDevClip.right = (int32_t)rcTemp.right; 105 rcDevClip.right = (int32_t)rcTemp.right;
106 rcDevClip.top = (int32_t)rcTemp.top; 106 rcDevClip.top = (int32_t)rcTemp.top;
107 rcDevClip.bottom = (int32_t)rcTemp.bottom; 107 rcDevClip.bottom = (int32_t)rcTemp.bottom;
108 pDevice->SetClip_Rect(&rcDevClip); 108 pDevice->SetClip_Rect(&rcDevClip);
109 } 109 }
110 110
111 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { 111 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) {
112 if (pEdit->GetFontMap()) { 112 if (pEdit->GetFontMap()) {
113 if (pRange) 113 if (pRange)
114 pIterator->SetAt(pRange->BeginPos); 114 pIterator->SetAt(pRange->BeginPos);
115 else 115 else
116 pIterator->SetAt(0); 116 pIterator->SetAt(0);
117 117
118 while (pIterator->NextWord()) { 118 while (pIterator->NextWord()) {
119 CPVT_WordPlace place = pIterator->GetAt(); 119 CPVT_WordPlace place = pIterator->GetAt();
120 if (pRange && place.WordCmp(pRange->EndPos) > 0) 120 if (pRange && place.WordCmp(pRange->EndPos) > 0)
121 break; 121 break;
122 122
123 CPVT_Word word; 123 CPVT_Word word;
124 if (pIterator->GetWord(word)) { 124 if (pIterator->GetWord(word)) {
125 CFX_PathData pathUnderline; 125 CFX_PathData pathUnderline;
126 CPDF_Rect rcUnderline = GetUnderLineRect(word); 126 CFX_FloatRect rcUnderline = GetUnderLineRect(word);
127 rcUnderline.left += ptOffset.x; 127 rcUnderline.left += ptOffset.x;
128 rcUnderline.right += ptOffset.x; 128 rcUnderline.right += ptOffset.x;
129 rcUnderline.top += ptOffset.y; 129 rcUnderline.top += ptOffset.y;
130 rcUnderline.bottom += ptOffset.y; 130 rcUnderline.bottom += ptOffset.y;
131 pathUnderline.AppendRect(rcUnderline.left, rcUnderline.bottom, 131 pathUnderline.AppendRect(rcUnderline.left, rcUnderline.bottom,
132 rcUnderline.right, rcUnderline.top); 132 rcUnderline.right, rcUnderline.top);
133 133
134 pDevice->DrawPath(&pathUnderline, pUser2Device, NULL, color, 0, 134 pDevice->DrawPath(&pathUnderline, pUser2Device, NULL, color, 0,
135 FXFILL_WINDING); 135 FXFILL_WINDING);
136 } 136 }
137 } 137 }
138 } 138 }
139 } 139 }
140 140
141 pDevice->RestoreState(); 141 pDevice->RestoreState();
142 } 142 }
143 143
144 void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, 144 void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice,
145 CFX_Matrix* pUser2Device, 145 CFX_Matrix* pUser2Device,
146 IFX_Edit* pEdit, 146 IFX_Edit* pEdit,
147 FX_COLORREF crTextFill, 147 FX_COLORREF crTextFill,
148 FX_COLORREF crTextStroke, 148 FX_COLORREF crTextStroke,
149 const CPDF_Rect& rcClip, 149 const CFX_FloatRect& rcClip,
150 const CPDF_Point& ptOffset, 150 const CFX_FloatPoint& ptOffset,
151 const CPVT_WordRange* pRange, 151 const CPVT_WordRange* pRange,
152 IFX_SystemHandler* pSystemHandler, 152 IFX_SystemHandler* pSystemHandler,
153 void* pFFLData) { 153 void* pFFLData) {
154 FX_BOOL bContinuous = pEdit->GetCharArray() == 0; 154 FX_BOOL bContinuous = pEdit->GetCharArray() == 0;
155 if (pEdit->GetCharSpace() > 0.0f) 155 if (pEdit->GetCharSpace() > 0.0f)
156 bContinuous = FALSE; 156 bContinuous = FALSE;
157 157
158 FX_WORD SubWord = pEdit->GetPasswordChar(); 158 FX_WORD SubWord = pEdit->GetPasswordChar();
159 FX_FLOAT fFontSize = pEdit->GetFontSize(); 159 FX_FLOAT fFontSize = pEdit->GetFontSize();
160 CPVT_WordRange wrSelect = pEdit->GetSelectWordRange(); 160 CPVT_WordRange wrSelect = pEdit->GetSelectWordRange();
161 int32_t nHorzScale = pEdit->GetHorzScale(); 161 int32_t nHorzScale = pEdit->GetHorzScale();
162 162
163 FX_COLORREF crCurFill = crTextFill; 163 FX_COLORREF crCurFill = crTextFill;
164 FX_COLORREF crOldFill = crCurFill; 164 FX_COLORREF crOldFill = crCurFill;
165 165
166 FX_BOOL bSelect = FALSE; 166 FX_BOOL bSelect = FALSE;
167 const FX_COLORREF crWhite = ArgbEncode(255, 255, 255, 255); 167 const FX_COLORREF crWhite = ArgbEncode(255, 255, 255, 255);
168 const FX_COLORREF crSelBK = ArgbEncode(255, 0, 51, 113); 168 const FX_COLORREF crSelBK = ArgbEncode(255, 0, 51, 113);
169 169
170 CFX_ByteTextBuf sTextBuf; 170 CFX_ByteTextBuf sTextBuf;
171 int32_t nFontIndex = -1; 171 int32_t nFontIndex = -1;
172 CPDF_Point ptBT(0.0f, 0.0f); 172 CFX_FloatPoint ptBT(0.0f, 0.0f);
173 173
174 pDevice->SaveState(); 174 pDevice->SaveState();
175 175
176 if (!rcClip.IsEmpty()) { 176 if (!rcClip.IsEmpty()) {
177 CPDF_Rect rcTemp = rcClip; 177 CFX_FloatRect rcTemp = rcClip;
178 pUser2Device->TransformRect(rcTemp); 178 pUser2Device->TransformRect(rcTemp);
179 FX_RECT rcDevClip; 179 FX_RECT rcDevClip;
180 rcDevClip.left = (int32_t)rcTemp.left; 180 rcDevClip.left = (int32_t)rcTemp.left;
181 rcDevClip.right = (int32_t)rcTemp.right; 181 rcDevClip.right = (int32_t)rcTemp.right;
182 rcDevClip.top = (int32_t)rcTemp.top; 182 rcDevClip.top = (int32_t)rcTemp.top;
183 rcDevClip.bottom = (int32_t)rcTemp.bottom; 183 rcDevClip.bottom = (int32_t)rcTemp.bottom;
184 pDevice->SetClip_Rect(&rcDevClip); 184 pDevice->SetClip_Rect(&rcDevClip);
185 } 185 }
186 186
187 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { 187 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) {
(...skipping 23 matching lines...) Expand all
211 crCurFill = crTextFill; 211 crCurFill = crTextFill;
212 crOldFill = crCurFill; 212 crOldFill = crCurFill;
213 } 213 }
214 CPVT_Word word; 214 CPVT_Word word;
215 if (pIterator->GetWord(word)) { 215 if (pIterator->GetWord(word)) {
216 if (bSelect) { 216 if (bSelect) {
217 CPVT_Line line; 217 CPVT_Line line;
218 pIterator->GetLine(line); 218 pIterator->GetLine(line);
219 219
220 if (pSystemHandler && pSystemHandler->IsSelectionImplemented()) { 220 if (pSystemHandler && pSystemHandler->IsSelectionImplemented()) {
221 CPDF_Rect rc(word.ptWord.x, line.ptLine.y + line.fLineDescent, 221 CFX_FloatRect rc(word.ptWord.x, line.ptLine.y + line.fLineDescent,
222 word.ptWord.x + word.fWidth, 222 word.ptWord.x + word.fWidth,
223 line.ptLine.y + line.fLineAscent); 223 line.ptLine.y + line.fLineAscent);
224 rc.Intersect(rcClip); 224 rc.Intersect(rcClip);
225 pSystemHandler->OutputSelectedRect(pFFLData, rc); 225 pSystemHandler->OutputSelectedRect(pFFLData, rc);
226 } else { 226 } else {
227 CFX_PathData pathSelBK; 227 CFX_PathData pathSelBK;
228 pathSelBK.AppendRect(word.ptWord.x, 228 pathSelBK.AppendRect(word.ptWord.x,
229 line.ptLine.y + line.fLineDescent, 229 line.ptLine.y + line.fLineDescent,
230 word.ptWord.x + word.fWidth, 230 word.ptWord.x + word.fWidth,
231 line.ptLine.y + line.fLineAscent); 231 line.ptLine.y + line.fLineAscent);
232 232
233 pDevice->DrawPath(&pathSelBK, pUser2Device, NULL, crSelBK, 0, 233 pDevice->DrawPath(&pathSelBK, pUser2Device, NULL, crSelBK, 0,
234 FXFILL_WINDING); 234 FXFILL_WINDING);
235 } 235 }
236 } 236 }
237 237
238 if (bContinuous) { 238 if (bContinuous) {
239 if (place.LineCmp(oldplace) != 0 || word.nFontIndex != nFontIndex || 239 if (place.LineCmp(oldplace) != 0 || word.nFontIndex != nFontIndex ||
240 crOldFill != crCurFill) { 240 crOldFill != crCurFill) {
241 if (sTextBuf.GetLength() > 0) { 241 if (sTextBuf.GetLength() > 0) {
242 DrawTextString(pDevice, CPDF_Point(ptBT.x + ptOffset.x, 242 DrawTextString(pDevice, CFX_FloatPoint(ptBT.x + ptOffset.x,
243 ptBT.y + ptOffset.y), 243 ptBT.y + ptOffset.y),
244 pFontMap->GetPDFFont(nFontIndex), fFontSize, 244 pFontMap->GetPDFFont(nFontIndex), fFontSize,
245 pUser2Device, sTextBuf.GetByteString(), 245 pUser2Device, sTextBuf.GetByteString(),
246 crOldFill, crTextStroke, nHorzScale); 246 crOldFill, crTextStroke, nHorzScale);
247 247
248 sTextBuf.Clear(); 248 sTextBuf.Clear();
249 } 249 }
250 nFontIndex = word.nFontIndex; 250 nFontIndex = word.nFontIndex;
251 ptBT = word.ptWord; 251 ptBT = word.ptWord;
252 crOldFill = crCurFill; 252 crOldFill = crCurFill;
253 } 253 }
254 254
255 sTextBuf << GetPDFWordString(pFontMap, word.nFontIndex, word.Word, 255 sTextBuf << GetPDFWordString(pFontMap, word.nFontIndex, word.Word,
256 SubWord); 256 SubWord);
257 } else { 257 } else {
258 DrawTextString( 258 DrawTextString(
259 pDevice, CPDF_Point(word.ptWord.x + ptOffset.x, 259 pDevice, CFX_FloatPoint(word.ptWord.x + ptOffset.x,
260 word.ptWord.y + ptOffset.y), 260 word.ptWord.y + ptOffset.y),
261 pFontMap->GetPDFFont(word.nFontIndex), fFontSize, pUser2Device, 261 pFontMap->GetPDFFont(word.nFontIndex), fFontSize, pUser2Device,
262 GetPDFWordString(pFontMap, word.nFontIndex, word.Word, SubWord), 262 GetPDFWordString(pFontMap, word.nFontIndex, word.Word, SubWord),
263 crCurFill, crTextStroke, nHorzScale); 263 crCurFill, crTextStroke, nHorzScale);
264 } 264 }
265 oldplace = place; 265 oldplace = place;
266 } 266 }
267 } 267 }
268 268
269 if (sTextBuf.GetLength() > 0) { 269 if (sTextBuf.GetLength() > 0) {
270 DrawTextString( 270 DrawTextString(
271 pDevice, CPDF_Point(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), 271 pDevice, CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
272 pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device, 272 pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device,
273 sTextBuf.GetByteString(), crOldFill, crTextStroke, nHorzScale); 273 sTextBuf.GetByteString(), crOldFill, crTextStroke, nHorzScale);
274 } 274 }
275 } 275 }
276 } 276 }
277 277
278 pDevice->RestoreState(); 278 pDevice->RestoreState();
279 } 279 }
280 280
281 void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, 281 void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice,
282 CFX_Matrix* pUser2Device, 282 CFX_Matrix* pUser2Device,
283 IFX_Edit* pEdit, 283 IFX_Edit* pEdit,
284 const CPDF_Rect& rcClip, 284 const CFX_FloatRect& rcClip,
285 const CPDF_Point& ptOffset, 285 const CFX_FloatPoint& ptOffset,
286 const CPVT_WordRange* pRange) { 286 const CPVT_WordRange* pRange) {
287 CPVT_WordRange wrSelect = pEdit->GetSelectWordRange(); 287 CPVT_WordRange wrSelect = pEdit->GetSelectWordRange();
288 288
289 FX_COLORREF crCurText = ArgbEncode(255, 0, 0, 0); 289 FX_COLORREF crCurText = ArgbEncode(255, 0, 0, 0);
290 FX_COLORREF crOld = crCurText; 290 FX_COLORREF crOld = crCurText;
291 FX_BOOL bSelect = FALSE; 291 FX_BOOL bSelect = FALSE;
292 const FX_COLORREF crWhite = ArgbEncode(255, 255, 255, 255); 292 const FX_COLORREF crWhite = ArgbEncode(255, 255, 255, 255);
293 const FX_COLORREF crSelBK = ArgbEncode(255, 0, 51, 113); 293 const FX_COLORREF crSelBK = ArgbEncode(255, 0, 51, 113);
294 294
295 CFX_ByteTextBuf sTextBuf; 295 CFX_ByteTextBuf sTextBuf;
296 CPVT_WordProps wp; 296 CPVT_WordProps wp;
297 CPDF_Point ptBT(0.0f, 0.0f); 297 CFX_FloatPoint ptBT(0.0f, 0.0f);
298 298
299 pDevice->SaveState(); 299 pDevice->SaveState();
300 300
301 if (!rcClip.IsEmpty()) { 301 if (!rcClip.IsEmpty()) {
302 CPDF_Rect rcTemp = rcClip; 302 CFX_FloatRect rcTemp = rcClip;
303 pUser2Device->TransformRect(rcTemp); 303 pUser2Device->TransformRect(rcTemp);
304 FX_RECT rcDevClip; 304 FX_RECT rcDevClip;
305 rcDevClip.left = (int32_t)rcTemp.left; 305 rcDevClip.left = (int32_t)rcTemp.left;
306 rcDevClip.right = (int32_t)rcTemp.right; 306 rcDevClip.right = (int32_t)rcTemp.right;
307 rcDevClip.top = (int32_t)rcTemp.top; 307 rcDevClip.top = (int32_t)rcTemp.top;
308 rcDevClip.bottom = (int32_t)rcTemp.bottom; 308 rcDevClip.bottom = (int32_t)rcTemp.bottom;
309 pDevice->SetClip_Rect(&rcDevClip); 309 pDevice->SetClip_Rect(&rcDevClip);
310 } 310 }
311 311
312 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { 312 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 pDevice->DrawPath(&pathSelBK, pUser2Device, NULL, crSelBK, 0, 350 pDevice->DrawPath(&pathSelBK, pUser2Device, NULL, crSelBK, 0,
351 FXFILL_WINDING); 351 FXFILL_WINDING);
352 } 352 }
353 353
354 if (place.LineCmp(oldplace) != 0 || 354 if (place.LineCmp(oldplace) != 0 ||
355 word.WordProps.fCharSpace > 0.0f || 355 word.WordProps.fCharSpace > 0.0f ||
356 word.WordProps.nHorzScale != 100 || 356 word.WordProps.nHorzScale != 100 ||
357 FXSYS_memcmp(&word.WordProps, &wp, sizeof(CPVT_WordProps)) != 0 || 357 FXSYS_memcmp(&word.WordProps, &wp, sizeof(CPVT_WordProps)) != 0 ||
358 crOld != crCurText) { 358 crOld != crCurText) {
359 if (sTextBuf.GetLength() > 0) { 359 if (sTextBuf.GetLength() > 0) {
360 DrawTextString( 360 DrawTextString(pDevice, CFX_FloatPoint(ptBT.x + ptOffset.x,
361 pDevice, CPDF_Point(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), 361 ptBT.y + ptOffset.y),
362 pFontMap->GetPDFFont(wp.nFontIndex), wp.fFontSize, 362 pFontMap->GetPDFFont(wp.nFontIndex), wp.fFontSize,
363 pUser2Device, sTextBuf.GetByteString(), crOld, 0, 363 pUser2Device, sTextBuf.GetByteString(), crOld, 0,
364 wp.nHorzScale); 364 wp.nHorzScale);
365 365
366 sTextBuf.Clear(); 366 sTextBuf.Clear();
367 } 367 }
368 wp = word.WordProps; 368 wp = word.WordProps;
369 ptBT = word.ptWord; 369 ptBT = word.ptWord;
370 crOld = crCurText; 370 crOld = crCurText;
371 } 371 }
372 372
373 sTextBuf << GetPDFWordString(pFontMap, word.WordProps.nFontIndex, 373 sTextBuf << GetPDFWordString(pFontMap, word.WordProps.nFontIndex,
374 word.Word, 0); 374 word.Word, 0);
375 375
376 if (word.WordProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) { 376 if (word.WordProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) {
377 CFX_PathData pathUnderline; 377 CFX_PathData pathUnderline;
378 CPDF_Rect rcUnderline = GetUnderLineRect(word); 378 CFX_FloatRect rcUnderline = GetUnderLineRect(word);
379 pathUnderline.AppendRect(rcUnderline.left, rcUnderline.bottom, 379 pathUnderline.AppendRect(rcUnderline.left, rcUnderline.bottom,
380 rcUnderline.right, rcUnderline.top); 380 rcUnderline.right, rcUnderline.top);
381 381
382 pDevice->DrawPath(&pathUnderline, pUser2Device, NULL, crCurText, 0, 382 pDevice->DrawPath(&pathUnderline, pUser2Device, NULL, crCurText, 0,
383 FXFILL_WINDING); 383 FXFILL_WINDING);
384 } 384 }
385 385
386 if (word.WordProps.nWordStyle & PVTWORD_STYLE_CROSSOUT) { 386 if (word.WordProps.nWordStyle & PVTWORD_STYLE_CROSSOUT) {
387 CFX_PathData pathCrossout; 387 CFX_PathData pathCrossout;
388 CPDF_Rect rcCrossout = GetCrossoutRect(word); 388 CFX_FloatRect rcCrossout = GetCrossoutRect(word);
389 pathCrossout.AppendRect(rcCrossout.left, rcCrossout.bottom, 389 pathCrossout.AppendRect(rcCrossout.left, rcCrossout.bottom,
390 rcCrossout.right, rcCrossout.top); 390 rcCrossout.right, rcCrossout.top);
391 391
392 pDevice->DrawPath(&pathCrossout, pUser2Device, NULL, crCurText, 0, 392 pDevice->DrawPath(&pathCrossout, pUser2Device, NULL, crCurText, 0,
393 FXFILL_WINDING); 393 FXFILL_WINDING);
394 } 394 }
395 395
396 oldplace = place; 396 oldplace = place;
397 } 397 }
398 } 398 }
399 399
400 if (sTextBuf.GetLength() > 0) { 400 if (sTextBuf.GetLength() > 0) {
401 DrawTextString( 401 DrawTextString(
402 pDevice, CPDF_Point(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), 402 pDevice, CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
403 pFontMap->GetPDFFont(wp.nFontIndex), wp.fFontSize, pUser2Device, 403 pFontMap->GetPDFFont(wp.nFontIndex), wp.fFontSize, pUser2Device,
404 sTextBuf.GetByteString(), crOld, 0, wp.nHorzScale); 404 sTextBuf.GetByteString(), crOld, 0, wp.nHorzScale);
405 } 405 }
406 } 406 }
407 } 407 }
408 408
409 pDevice->RestoreState(); 409 pDevice->RestoreState();
410 } 410 }
411 411
412 static void AddRectToPageObjects(CPDF_PageObjectHolder* pObjectHolder, 412 static void AddRectToPageObjects(CPDF_PageObjectHolder* pObjectHolder,
413 FX_COLORREF crFill, 413 FX_COLORREF crFill,
414 const CPDF_Rect& rcFill) { 414 const CFX_FloatRect& rcFill) {
415 std::unique_ptr<CPDF_PathObject> pPathObj(new CPDF_PathObject); 415 std::unique_ptr<CPDF_PathObject> pPathObj(new CPDF_PathObject);
416 CFX_PathData* pPathData = pPathObj->m_Path.GetModify(); 416 CFX_PathData* pPathData = pPathObj->m_Path.GetModify();
417 pPathData->AppendRect(rcFill.left, rcFill.bottom, rcFill.right, rcFill.top); 417 pPathData->AppendRect(rcFill.left, rcFill.bottom, rcFill.right, rcFill.top);
418 418
419 FX_FLOAT rgb[3]; 419 FX_FLOAT rgb[3];
420 rgb[0] = FXARGB_R(crFill) / 255.0f; 420 rgb[0] = FXARGB_R(crFill) / 255.0f;
421 rgb[1] = FXARGB_G(crFill) / 255.0f; 421 rgb[1] = FXARGB_G(crFill) / 255.0f;
422 rgb[2] = FXARGB_B(crFill) / 255.0f; 422 rgb[2] = FXARGB_B(crFill) / 255.0f;
423 pPathObj->m_ColorState.SetFillColor( 423 pPathObj->m_ColorState.SetFillColor(
424 CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB), rgb, 3); 424 CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB), rgb, 3);
425 425
426 pPathObj->m_FillType = FXFILL_ALTERNATE; 426 pPathObj->m_FillType = FXFILL_ALTERNATE;
427 pPathObj->m_bStroke = FALSE; 427 pPathObj->m_bStroke = FALSE;
428 pObjectHolder->GetPageObjectList()->push_back(std::move(pPathObj)); 428 pObjectHolder->GetPageObjectList()->push_back(std::move(pPathObj));
429 } 429 }
430 430
431 static CPDF_TextObject* AddTextObjToPageObjects( 431 static CPDF_TextObject* AddTextObjToPageObjects(
432 CPDF_PageObjectHolder* pObjectHolder, 432 CPDF_PageObjectHolder* pObjectHolder,
433 FX_COLORREF crText, 433 FX_COLORREF crText,
434 CPDF_Font* pFont, 434 CPDF_Font* pFont,
435 FX_FLOAT fFontSize, 435 FX_FLOAT fFontSize,
436 FX_FLOAT fCharSpace, 436 FX_FLOAT fCharSpace,
437 int32_t nHorzScale, 437 int32_t nHorzScale,
438 const CPDF_Point& point, 438 const CFX_FloatPoint& point,
439 const CFX_ByteString& text) { 439 const CFX_ByteString& text) {
440 std::unique_ptr<CPDF_TextObject> pTxtObj(new CPDF_TextObject); 440 std::unique_ptr<CPDF_TextObject> pTxtObj(new CPDF_TextObject);
441 CPDF_TextStateData* pTextStateData = pTxtObj->m_TextState.GetModify(); 441 CPDF_TextStateData* pTextStateData = pTxtObj->m_TextState.GetModify();
442 pTextStateData->m_pFont = pFont; 442 pTextStateData->m_pFont = pFont;
443 pTextStateData->m_FontSize = fFontSize; 443 pTextStateData->m_FontSize = fFontSize;
444 pTextStateData->m_CharSpace = fCharSpace; 444 pTextStateData->m_CharSpace = fCharSpace;
445 pTextStateData->m_WordSpace = 0; 445 pTextStateData->m_WordSpace = 0;
446 pTextStateData->m_TextMode = 0; 446 pTextStateData->m_TextMode = 0;
447 pTextStateData->m_Matrix[0] = nHorzScale / 100.0f; 447 pTextStateData->m_Matrix[0] = nHorzScale / 100.0f;
448 pTextStateData->m_Matrix[1] = 0; 448 pTextStateData->m_Matrix[1] = 0;
(...skipping 13 matching lines...) Expand all
462 pTxtObj->SetText(text); 462 pTxtObj->SetText(text);
463 463
464 CPDF_TextObject* pRet = pTxtObj.get(); 464 CPDF_TextObject* pRet = pTxtObj.get();
465 pObjectHolder->GetPageObjectList()->push_back(std::move(pTxtObj)); 465 pObjectHolder->GetPageObjectList()->push_back(std::move(pTxtObj));
466 return pRet; 466 return pRet;
467 } 467 }
468 468
469 void IFX_Edit::GeneratePageObjects( 469 void IFX_Edit::GeneratePageObjects(
470 CPDF_PageObjectHolder* pObjectHolder, 470 CPDF_PageObjectHolder* pObjectHolder,
471 IFX_Edit* pEdit, 471 IFX_Edit* pEdit,
472 const CPDF_Point& ptOffset, 472 const CFX_FloatPoint& ptOffset,
473 const CPVT_WordRange* pRange, 473 const CPVT_WordRange* pRange,
474 FX_COLORREF crText, 474 FX_COLORREF crText,
475 CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray) { 475 CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray) {
476 FX_FLOAT fFontSize = pEdit->GetFontSize(); 476 FX_FLOAT fFontSize = pEdit->GetFontSize();
477 477
478 int32_t nOldFontIndex = -1; 478 int32_t nOldFontIndex = -1;
479 479
480 CFX_ByteTextBuf sTextBuf; 480 CFX_ByteTextBuf sTextBuf;
481 CPDF_Point ptBT(0.0f, 0.0f); 481 CFX_FloatPoint ptBT(0.0f, 0.0f);
482 482
483 ObjArray.RemoveAll(); 483 ObjArray.RemoveAll();
484 484
485 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { 485 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) {
486 if (IFX_Edit_FontMap* pFontMap = pEdit->GetFontMap()) { 486 if (IFX_Edit_FontMap* pFontMap = pEdit->GetFontMap()) {
487 if (pRange) 487 if (pRange)
488 pIterator->SetAt(pRange->BeginPos); 488 pIterator->SetAt(pRange->BeginPos);
489 else 489 else
490 pIterator->SetAt(0); 490 pIterator->SetAt(0);
491 491
492 CPVT_WordPlace oldplace; 492 CPVT_WordPlace oldplace;
493 493
494 while (pIterator->NextWord()) { 494 while (pIterator->NextWord()) {
495 CPVT_WordPlace place = pIterator->GetAt(); 495 CPVT_WordPlace place = pIterator->GetAt();
496 if (pRange && place.WordCmp(pRange->EndPos) > 0) 496 if (pRange && place.WordCmp(pRange->EndPos) > 0)
497 break; 497 break;
498 498
499 CPVT_Word word; 499 CPVT_Word word;
500 if (pIterator->GetWord(word)) { 500 if (pIterator->GetWord(word)) {
501 if (place.LineCmp(oldplace) != 0 || 501 if (place.LineCmp(oldplace) != 0 ||
502 nOldFontIndex != word.nFontIndex) { 502 nOldFontIndex != word.nFontIndex) {
503 if (sTextBuf.GetLength() > 0) { 503 if (sTextBuf.GetLength() > 0) {
504 ObjArray.Add(AddTextObjToPageObjects( 504 ObjArray.Add(AddTextObjToPageObjects(
505 pObjectHolder, crText, pFontMap->GetPDFFont(nOldFontIndex), 505 pObjectHolder, crText, pFontMap->GetPDFFont(nOldFontIndex),
506 fFontSize, 0.0f, 100, 506 fFontSize, 0.0f, 100,
507 CPDF_Point(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), 507 CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
508 sTextBuf.GetByteString())); 508 sTextBuf.GetByteString()));
509 509
510 sTextBuf.Clear(); 510 sTextBuf.Clear();
511 } 511 }
512 512
513 ptBT = word.ptWord; 513 ptBT = word.ptWord;
514 nOldFontIndex = word.nFontIndex; 514 nOldFontIndex = word.nFontIndex;
515 } 515 }
516 516
517 sTextBuf << GetPDFWordString(pFontMap, word.nFontIndex, word.Word, 0); 517 sTextBuf << GetPDFWordString(pFontMap, word.nFontIndex, word.Word, 0);
518 oldplace = place; 518 oldplace = place;
519 } 519 }
520 } 520 }
521 521
522 if (sTextBuf.GetLength() > 0) { 522 if (sTextBuf.GetLength() > 0) {
523 ObjArray.Add(AddTextObjToPageObjects( 523 ObjArray.Add(AddTextObjToPageObjects(
524 pObjectHolder, crText, pFontMap->GetPDFFont(nOldFontIndex), 524 pObjectHolder, crText, pFontMap->GetPDFFont(nOldFontIndex),
525 fFontSize, 0.0f, 100, 525 fFontSize, 0.0f, 100,
526 CPDF_Point(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), 526 CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
527 sTextBuf.GetByteString())); 527 sTextBuf.GetByteString()));
528 } 528 }
529 } 529 }
530 } 530 }
531 } 531 }
532 532
533 void IFX_Edit::GenerateRichPageObjects( 533 void IFX_Edit::GenerateRichPageObjects(
534 CPDF_PageObjectHolder* pObjectHolder, 534 CPDF_PageObjectHolder* pObjectHolder,
535 IFX_Edit* pEdit, 535 IFX_Edit* pEdit,
536 const CPDF_Point& ptOffset, 536 const CFX_FloatPoint& ptOffset,
537 const CPVT_WordRange* pRange, 537 const CPVT_WordRange* pRange,
538 CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray) { 538 CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray) {
539 FX_COLORREF crCurText = ArgbEncode(255, 0, 0, 0); 539 FX_COLORREF crCurText = ArgbEncode(255, 0, 0, 0);
540 FX_COLORREF crOld = crCurText; 540 FX_COLORREF crOld = crCurText;
541 541
542 CFX_ByteTextBuf sTextBuf; 542 CFX_ByteTextBuf sTextBuf;
543 CPVT_WordProps wp; 543 CPVT_WordProps wp;
544 CPDF_Point ptBT(0.0f, 0.0f); 544 CFX_FloatPoint ptBT(0.0f, 0.0f);
545 545
546 ObjArray.RemoveAll(); 546 ObjArray.RemoveAll();
547 547
548 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { 548 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) {
549 if (IFX_Edit_FontMap* pFontMap = pEdit->GetFontMap()) { 549 if (IFX_Edit_FontMap* pFontMap = pEdit->GetFontMap()) {
550 if (pRange) 550 if (pRange)
551 pIterator->SetAt(pRange->BeginPos); 551 pIterator->SetAt(pRange->BeginPos);
552 else 552 else
553 pIterator->SetAt(0); 553 pIterator->SetAt(0);
554 554
(...skipping 12 matching lines...) Expand all
567 567
568 if (place.LineCmp(oldplace) != 0 || 568 if (place.LineCmp(oldplace) != 0 ||
569 word.WordProps.fCharSpace > 0.0f || 569 word.WordProps.fCharSpace > 0.0f ||
570 word.WordProps.nHorzScale != 100 || 570 word.WordProps.nHorzScale != 100 ||
571 FXSYS_memcmp(&word.WordProps, &wp, sizeof(CPVT_WordProps)) != 0 || 571 FXSYS_memcmp(&word.WordProps, &wp, sizeof(CPVT_WordProps)) != 0 ||
572 crOld != crCurText) { 572 crOld != crCurText) {
573 if (sTextBuf.GetLength() > 0) { 573 if (sTextBuf.GetLength() > 0) {
574 ObjArray.Add(AddTextObjToPageObjects( 574 ObjArray.Add(AddTextObjToPageObjects(
575 pObjectHolder, crOld, pFontMap->GetPDFFont(wp.nFontIndex), 575 pObjectHolder, crOld, pFontMap->GetPDFFont(wp.nFontIndex),
576 wp.fFontSize, wp.fCharSpace, wp.nHorzScale, 576 wp.fFontSize, wp.fCharSpace, wp.nHorzScale,
577 CPDF_Point(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), 577 CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
578 sTextBuf.GetByteString())); 578 sTextBuf.GetByteString()));
579 579
580 sTextBuf.Clear(); 580 sTextBuf.Clear();
581 } 581 }
582 582
583 wp = word.WordProps; 583 wp = word.WordProps;
584 ptBT = word.ptWord; 584 ptBT = word.ptWord;
585 crOld = crCurText; 585 crOld = crCurText;
586 } 586 }
587 587
588 sTextBuf << GetPDFWordString(pFontMap, word.WordProps.nFontIndex, 588 sTextBuf << GetPDFWordString(pFontMap, word.WordProps.nFontIndex,
589 word.Word, 0); 589 word.Word, 0);
590 590
591 if (word.WordProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) { 591 if (word.WordProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) {
592 CPDF_Rect rcUnderline = GetUnderLineRect(word); 592 CFX_FloatRect rcUnderline = GetUnderLineRect(word);
593 rcUnderline.left += ptOffset.x; 593 rcUnderline.left += ptOffset.x;
594 rcUnderline.right += ptOffset.x; 594 rcUnderline.right += ptOffset.x;
595 rcUnderline.top += ptOffset.y; 595 rcUnderline.top += ptOffset.y;
596 rcUnderline.bottom += ptOffset.y; 596 rcUnderline.bottom += ptOffset.y;
597 597
598 AddRectToPageObjects(pObjectHolder, crCurText, rcUnderline); 598 AddRectToPageObjects(pObjectHolder, crCurText, rcUnderline);
599 } 599 }
600 600
601 if (word.WordProps.nWordStyle & PVTWORD_STYLE_CROSSOUT) { 601 if (word.WordProps.nWordStyle & PVTWORD_STYLE_CROSSOUT) {
602 CPDF_Rect rcCrossout = GetCrossoutRect(word); 602 CFX_FloatRect rcCrossout = GetCrossoutRect(word);
603 rcCrossout.left += ptOffset.x; 603 rcCrossout.left += ptOffset.x;
604 rcCrossout.right += ptOffset.x; 604 rcCrossout.right += ptOffset.x;
605 rcCrossout.top += ptOffset.y; 605 rcCrossout.top += ptOffset.y;
606 rcCrossout.bottom += ptOffset.y; 606 rcCrossout.bottom += ptOffset.y;
607 607
608 AddRectToPageObjects(pObjectHolder, crCurText, rcCrossout); 608 AddRectToPageObjects(pObjectHolder, crCurText, rcCrossout);
609 } 609 }
610 610
611 oldplace = place; 611 oldplace = place;
612 } 612 }
613 } 613 }
614 614
615 if (sTextBuf.GetLength() > 0) { 615 if (sTextBuf.GetLength() > 0) {
616 ObjArray.Add(AddTextObjToPageObjects( 616 ObjArray.Add(AddTextObjToPageObjects(
617 pObjectHolder, crOld, pFontMap->GetPDFFont(wp.nFontIndex), 617 pObjectHolder, crOld, pFontMap->GetPDFFont(wp.nFontIndex),
618 wp.fFontSize, wp.fCharSpace, wp.nHorzScale, 618 wp.fFontSize, wp.fCharSpace, wp.nHorzScale,
619 CPDF_Point(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), 619 CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
620 sTextBuf.GetByteString())); 620 sTextBuf.GetByteString()));
621 } 621 }
622 } 622 }
623 } 623 }
624 } 624 }
625 625
626 void IFX_Edit::GenerateUnderlineObjects(CPDF_PageObjectHolder* pObjectHolder, 626 void IFX_Edit::GenerateUnderlineObjects(CPDF_PageObjectHolder* pObjectHolder,
627 IFX_Edit* pEdit, 627 IFX_Edit* pEdit,
628 const CPDF_Point& ptOffset, 628 const CFX_FloatPoint& ptOffset,
629 const CPVT_WordRange* pRange, 629 const CPVT_WordRange* pRange,
630 FX_COLORREF color) { 630 FX_COLORREF color) {
631 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { 631 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) {
632 if (pEdit->GetFontMap()) { 632 if (pEdit->GetFontMap()) {
633 if (pRange) 633 if (pRange)
634 pIterator->SetAt(pRange->BeginPos); 634 pIterator->SetAt(pRange->BeginPos);
635 else 635 else
636 pIterator->SetAt(0); 636 pIterator->SetAt(0);
637 637
638 CPVT_WordPlace oldplace; 638 CPVT_WordPlace oldplace;
639 639
640 while (pIterator->NextWord()) { 640 while (pIterator->NextWord()) {
641 CPVT_WordPlace place = pIterator->GetAt(); 641 CPVT_WordPlace place = pIterator->GetAt();
642 if (pRange && place.WordCmp(pRange->EndPos) > 0) 642 if (pRange && place.WordCmp(pRange->EndPos) > 0)
643 break; 643 break;
644 644
645 CPVT_Word word; 645 CPVT_Word word;
646 if (pIterator->GetWord(word)) { 646 if (pIterator->GetWord(word)) {
647 CPDF_Rect rcUnderline = GetUnderLineRect(word); 647 CFX_FloatRect rcUnderline = GetUnderLineRect(word);
648 rcUnderline.left += ptOffset.x; 648 rcUnderline.left += ptOffset.x;
649 rcUnderline.right += ptOffset.x; 649 rcUnderline.right += ptOffset.x;
650 rcUnderline.top += ptOffset.y; 650 rcUnderline.top += ptOffset.y;
651 rcUnderline.bottom += ptOffset.y; 651 rcUnderline.bottom += ptOffset.y;
652 AddRectToPageObjects(pObjectHolder, color, rcUnderline); 652 AddRectToPageObjects(pObjectHolder, color, rcUnderline);
653 } 653 }
654 } 654 }
655 } 655 }
656 } 656 }
657 } 657 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/fxedit/fxet_list.cpp ('k') | fpdfsdk/src/javascript/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698