OLD | NEW |
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 "../../include/fpdfdoc/fpdf_doc.h" | 7 #include "../../include/fpdfdoc/fpdf_doc.h" |
8 #include "../../include/fpdfdoc/fpdf_vt.h" | 8 #include "../../include/fpdfdoc/fpdf_vt.h" |
9 #include "pdf_vt.h" | 9 #include "pdf_vt.h" |
10 const uint8_t gFontSizeSteps[] = { 4, 6, 8, 9, 10, 12, 14, 18, 20, 25,
30, 35, 40, 45, 50, 55, 60, 70, 80, 90, 100, 110, 120, 130, 144}; | 10 const uint8_t gFontSizeSteps[] = { 4, 6, 8, 9, 10, 12, 14, 18, 20, 25,
30, 35, 40, 45, 50, 55, 60, 70, 80, 90, 100, 110, 120, 130, 144}; |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 } | 178 } |
179 } else { | 179 } else { |
180 break; | 180 break; |
181 } | 181 } |
182 } | 182 } |
183 } | 183 } |
184 CPVT_WordPlace CSection::SearchWordPlace(const CPDF_Point & point) const | 184 CPVT_WordPlace CSection::SearchWordPlace(const CPDF_Point & point) const |
185 { | 185 { |
186 ASSERT(m_pVT != NULL); | 186 ASSERT(m_pVT != NULL); |
187 CPVT_WordPlace place = GetBeginWordPlace(); | 187 CPVT_WordPlace place = GetBeginWordPlace(); |
188 FX_BOOL bUp = TRUE; | 188 bool bUp = true; |
189 FX_BOOL bDown = TRUE; | 189 bool bDown = true; |
190 int32_t nLeft = 0; | 190 int32_t nLeft = 0; |
191 int32_t nRight = m_LineArray.GetSize() - 1; | 191 int32_t nRight = m_LineArray.GetSize() - 1; |
192 int32_t nMid = m_LineArray.GetSize() / 2; | 192 int32_t nMid = m_LineArray.GetSize() / 2; |
193 FX_FLOAT fTop = 0; | 193 FX_FLOAT fTop = 0; |
194 FX_FLOAT fBottom = 0; | 194 FX_FLOAT fBottom = 0; |
195 while (nLeft <= nRight) { | 195 while (nLeft <= nRight) { |
196 if (CLine * pLine = m_LineArray.GetAt(nMid)) { | 196 if (CLine * pLine = m_LineArray.GetAt(nMid)) { |
197 fTop = pLine->m_LineInfo.fLineY - pLine->m_LineInfo.fLineAscent - m_
pVT->GetLineLeading(m_SecInfo); | 197 fTop = pLine->m_LineInfo.fLineY - pLine->m_LineInfo.fLineAscent - m_
pVT->GetLineLeading(m_SecInfo); |
198 fBottom = pLine->m_LineInfo.fLineY - pLine->m_LineInfo.fLineDescent; | 198 fBottom = pLine->m_LineInfo.fLineY - pLine->m_LineInfo.fLineDescent; |
199 if (IsFloatBigger(point.y, fTop)) { | 199 if (IsFloatBigger(point.y, fTop)) { |
200 bUp = FALSE; | 200 bUp = false; |
201 } | 201 } |
202 if (IsFloatSmaller(point.y, fBottom)) { | 202 if (IsFloatSmaller(point.y, fBottom)) { |
203 bDown = FALSE; | 203 bDown = false; |
204 } | 204 } |
205 if (IsFloatSmaller(point.y, fTop)) { | 205 if (IsFloatSmaller(point.y, fTop)) { |
206 nRight = nMid - 1; | 206 nRight = nMid - 1; |
207 nMid = (nLeft + nRight) / 2; | 207 nMid = (nLeft + nRight) / 2; |
208 continue; | 208 continue; |
209 } else if (IsFloatBigger(point.y, fBottom)) { | 209 } else if (IsFloatBigger(point.y, fBottom)) { |
210 nLeft = nMid + 1; | 210 nLeft = nMid + 1; |
211 nMid = (nLeft + nRight) / 2; | 211 nMid = (nLeft + nRight) / 2; |
212 continue; | 212 continue; |
213 } else { | 213 } else { |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 pLine->m_LineInfo.fLineAscent = fLineAscent; | 389 pLine->m_LineInfo.fLineAscent = fLineAscent; |
390 pLine->m_LineInfo.fLineDescent = fLineDescent; | 390 pLine->m_LineInfo.fLineDescent = fLineDescent; |
391 y += (-fLineDescent); | 391 y += (-fLineDescent); |
392 } | 392 } |
393 return m_rcRet = CPVT_FloatRect(0, 0, x, y); | 393 return m_rcRet = CPVT_FloatRect(0, 0, x, y); |
394 } | 394 } |
395 CPVT_Size CTypeset::GetEditSize(FX_FLOAT fFontSize) | 395 CPVT_Size CTypeset::GetEditSize(FX_FLOAT fFontSize) |
396 { | 396 { |
397 ASSERT(m_pSection != NULL); | 397 ASSERT(m_pSection != NULL); |
398 ASSERT(m_pVT != NULL); | 398 ASSERT(m_pVT != NULL); |
399 SplitLines(FALSE, fFontSize); | 399 SplitLines(false, fFontSize); |
400 return CPVT_Size(m_rcRet.Width(), m_rcRet.Height()); | 400 return CPVT_Size(m_rcRet.Width(), m_rcRet.Height()); |
401 } | 401 } |
402 CPVT_FloatRect CTypeset::Typeset() | 402 CPVT_FloatRect CTypeset::Typeset() |
403 { | 403 { |
404 ASSERT(m_pSection != NULL); | 404 ASSERT(m_pSection != NULL); |
405 ASSERT(m_pVT != NULL); | 405 ASSERT(m_pVT != NULL); |
406 m_pSection->m_LineArray.Empty(); | 406 m_pSection->m_LineArray.Empty(); |
407 SplitLines(TRUE, 0.0f); | 407 SplitLines(true, 0.0f); |
408 m_pSection->m_LineArray.Clear(); | 408 m_pSection->m_LineArray.Clear(); |
409 OutputLines(); | 409 OutputLines(); |
410 return m_rcRet; | 410 return m_rcRet; |
411 } | 411 } |
412 static int special_chars[128] = { | 412 static int special_chars[128] = { |
413 0x0000, 0x000C, 0x0008, 0x000C, 0x0008, 0x0000, 0x0020, 0x0000, | 413 0x0000, 0x000C, 0x0008, 0x000C, 0x0008, 0x0000, 0x0020, 0x0000, |
414 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | 414 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
415 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | 415 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
416 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | 416 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
417 0x0000, 0x0008, 0x0008, 0x0000, 0x0010, 0x0000, 0x0000, 0x0028, | 417 0x0000, 0x0008, 0x0008, 0x0000, 0x0010, 0x0000, 0x0000, 0x0028, |
418 0x000C, 0x0008, 0x0000, 0x0000, 0x0028, 0x0028, 0x0028, 0x0028, | 418 0x000C, 0x0008, 0x0000, 0x0000, 0x0028, 0x0028, 0x0028, 0x0028, |
419 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, | 419 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, |
420 0x0002, 0x0002, 0x0008, 0x0008, 0x0000, 0x0000, 0x0000, 0x0008, | 420 0x0002, 0x0002, 0x0008, 0x0008, 0x0000, 0x0000, 0x0000, 0x0008, |
421 0x0000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, | 421 0x0000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, |
422 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, | 422 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, |
423 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, | 423 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, |
424 0x0001, 0x0001, 0x0001, 0x000C, 0x0000, 0x0008, 0x0000, 0x0000, | 424 0x0001, 0x0001, 0x0001, 0x000C, 0x0000, 0x0008, 0x0000, 0x0000, |
425 0x0000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, | 425 0x0000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, |
426 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, | 426 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, |
427 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, | 427 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, |
428 0x0001, 0x0001, 0x0001, 0x000C, 0x0000, 0x0008, 0x0000, 0x0000, | 428 0x0001, 0x0001, 0x0001, 0x000C, 0x0000, 0x0008, 0x0000, 0x0000, |
429 }; | 429 }; |
430 static FX_BOOL IsLatin(FX_WORD word) | 430 static bool IsLatin(FX_WORD word) |
431 { | 431 { |
432 if (word <= 0x007F) { | 432 if (word <= 0x007F) { |
433 if (special_chars[word] & 0x0001) { | 433 if (special_chars[word] & 0x0001) { |
434 return TRUE; | 434 return true; |
435 } | 435 } |
436 } | 436 } |
437 if ((word >= 0x00C0 && word <= 0x00FF) || | 437 if ((word >= 0x00C0 && word <= 0x00FF) || |
438 (word >= 0x0100 && word <= 0x024F) || | 438 (word >= 0x0100 && word <= 0x024F) || |
439 (word >= 0x1E00 && word <= 0x1EFF) || | 439 (word >= 0x1E00 && word <= 0x1EFF) || |
440 (word >= 0x2C60 && word <= 0x2C7F) || | 440 (word >= 0x2C60 && word <= 0x2C7F) || |
441 (word >= 0xA720 && word <= 0xA7FF) || | 441 (word >= 0xA720 && word <= 0xA7FF) || |
442 (word >= 0xFF21 && word <= 0xFF3A) || | 442 (word >= 0xFF21 && word <= 0xFF3A) || |
443 (word >= 0xFF41 && word <= 0xFF5A)) { | 443 (word >= 0xFF41 && word <= 0xFF5A)) { |
444 return TRUE; | 444 return true; |
445 } | 445 } |
446 return FALSE; | 446 return false; |
447 } | 447 } |
448 static FX_BOOL IsDigit(FX_DWORD word) | 448 static bool IsDigit(FX_DWORD word) |
449 { | 449 { |
450 return (word >= 0x0030 && word <= 0x0039) ? TRUE : FALSE; | 450 return (word >= 0x0030 && word <= 0x0039) ? true : false; |
451 } | 451 } |
452 static FX_BOOL IsCJK(FX_DWORD word) | 452 static bool IsCJK(FX_DWORD word) |
453 { | 453 { |
454 if ((word >= 0x1100 && word <= 0x11FF) || | 454 if ((word >= 0x1100 && word <= 0x11FF) || |
455 (word >= 0x2E80 && word <= 0x2FFF) || | 455 (word >= 0x2E80 && word <= 0x2FFF) || |
456 (word >= 0x3040 && word <= 0x9FBF) || | 456 (word >= 0x3040 && word <= 0x9FBF) || |
457 (word >= 0xAC00 && word <= 0xD7AF) || | 457 (word >= 0xAC00 && word <= 0xD7AF) || |
458 (word >= 0xF900 && word <= 0xFAFF) || | 458 (word >= 0xF900 && word <= 0xFAFF) || |
459 (word >= 0xFE30 && word <= 0xFE4F) || | 459 (word >= 0xFE30 && word <= 0xFE4F) || |
460 (word >= 0x20000 && word <= 0x2A6DF) || | 460 (word >= 0x20000 && word <= 0x2A6DF) || |
461 (word >= 0x2F800 && word <= 0x2FA1F)) { | 461 (word >= 0x2F800 && word <= 0x2FA1F)) { |
462 return TRUE; | 462 return true; |
463 } | 463 } |
464 if (word >= 0x3000 && word <= 0x303F) { | 464 if (word >= 0x3000 && word <= 0x303F) { |
465 if (word == 0x3005 || word == 0x3006 || word == 0x3021 || word == 0x3022
|| | 465 if (word == 0x3005 || word == 0x3006 || word == 0x3021 || word == 0x3022
|| |
466 word == 0x3023 || word == 0x3024 || word == 0x3025 || word == 0x
3026 || | 466 word == 0x3023 || word == 0x3024 || word == 0x3025 || word == 0x
3026 || |
467 word == 0x3027 || word == 0x3028 || word == 0x3029 || word == 0x
3031 || | 467 word == 0x3027 || word == 0x3028 || word == 0x3029 || word == 0x
3031 || |
468 word == 0x3032 || word == 0x3033 || word == 0x3034 || word == 0x
3035) { | 468 word == 0x3032 || word == 0x3033 || word == 0x3034 || word == 0x
3035) { |
469 return TRUE; | 469 return true; |
470 } | 470 } |
471 return FALSE; | 471 return false; |
472 } | 472 } |
473 if (word >= 0xFF66 && word <= 0xFF9D) { | 473 if (word >= 0xFF66 && word <= 0xFF9D) { |
474 return TRUE; | 474 return true; |
475 } | 475 } |
476 return FALSE; | 476 return false; |
477 } | 477 } |
478 static FX_BOOL IsPunctuation(FX_DWORD word) | 478 static bool IsPunctuation(FX_DWORD word) |
479 { | 479 { |
480 if (word <= 0x007F) { | 480 if (word <= 0x007F) { |
481 if ((special_chars[word] >> 3) & 1) { | 481 if ((special_chars[word] >> 3) & 1) { |
482 return TRUE; | 482 return true; |
483 } | 483 } |
484 } else if (word >= 0x0080 && word <= 0x00FF) { | 484 } else if (word >= 0x0080 && word <= 0x00FF) { |
485 if (word == 0x0082 || word == 0x0084 || word == 0x0085 || word == 0x0091
|| | 485 if (word == 0x0082 || word == 0x0084 || word == 0x0085 || word == 0x0091
|| |
486 word == 0x0092 || word == 0x0093 || word <= 0x0094 || word == 0x
0096 || | 486 word == 0x0092 || word == 0x0093 || word <= 0x0094 || word == 0x
0096 || |
487 word == 0x00B4 || word == 0x00B8) { | 487 word == 0x00B4 || word == 0x00B8) { |
488 return TRUE; | 488 return true; |
489 } | 489 } |
490 } else if (word >= 0x2000 && word <= 0x206F) { | 490 } else if (word >= 0x2000 && word <= 0x206F) { |
491 if (word == 0x2010 || word == 0x2011 || word == 0x2012 || word == 0x2013
|| | 491 if (word == 0x2010 || word == 0x2011 || word == 0x2012 || word == 0x2013
|| |
492 word == 0x2018 || word == 0x2019 || word == 0x201A || word == 0x
201B || | 492 word == 0x2018 || word == 0x2019 || word == 0x201A || word == 0x
201B || |
493 word == 0x201C || word == 0x201D || word == 0x201E || word == 0x
201F || | 493 word == 0x201C || word == 0x201D || word == 0x201E || word == 0x
201F || |
494 word == 0x2032 || word == 0x2033 || word == 0x2034 || word == 0x
2035 || | 494 word == 0x2032 || word == 0x2033 || word == 0x2034 || word == 0x
2035 || |
495 word == 0x2036 || word == 0x2037 || word == 0x203C || word == 0x
203D || | 495 word == 0x2036 || word == 0x2037 || word == 0x203C || word == 0x
203D || |
496 word == 0x203E || word == 0x2044) { | 496 word == 0x203E || word == 0x2044) { |
497 return TRUE; | 497 return true; |
498 } | 498 } |
499 } else if (word >= 0x3000 && word <= 0x303F) { | 499 } else if (word >= 0x3000 && word <= 0x303F) { |
500 if (word == 0x3001 || word == 0x3002 || word == 0x3003 || word == 0x3005
|| | 500 if (word == 0x3001 || word == 0x3002 || word == 0x3003 || word == 0x3005
|| |
501 word == 0x3009 || word == 0x300A || word == 0x300B || word == 0x
300C || | 501 word == 0x3009 || word == 0x300A || word == 0x300B || word == 0x
300C || |
502 word == 0x300D || word == 0x300F || word == 0x300E || word == 0x
3010 || | 502 word == 0x300D || word == 0x300F || word == 0x300E || word == 0x
3010 || |
503 word == 0x3011 || word == 0x3014 || word == 0x3015 || word == 0x
3016 || | 503 word == 0x3011 || word == 0x3014 || word == 0x3015 || word == 0x
3016 || |
504 word == 0x3017 || word == 0x3018 || word == 0x3019 || word == 0x
301A || | 504 word == 0x3017 || word == 0x3018 || word == 0x3019 || word == 0x
301A || |
505 word == 0x301B || word == 0x301D || word == 0x301E || word == 0x
301F) { | 505 word == 0x301B || word == 0x301D || word == 0x301E || word == 0x
301F) { |
506 return TRUE; | 506 return true; |
507 } | 507 } |
508 } else if (word >= 0xFE50 && word <= 0xFE6F) { | 508 } else if (word >= 0xFE50 && word <= 0xFE6F) { |
509 if ((word >= 0xFE50 && word <= 0xFE5E) || word == 0xFE63) { | 509 if ((word >= 0xFE50 && word <= 0xFE5E) || word == 0xFE63) { |
510 return TRUE; | 510 return true; |
511 } | 511 } |
512 } else if (word >= 0xFF00 && word <= 0xFFEF) { | 512 } else if (word >= 0xFF00 && word <= 0xFFEF) { |
513 if (word == 0xFF01 || word == 0xFF02 || word == 0xFF07 || word == 0xFF08
|| | 513 if (word == 0xFF01 || word == 0xFF02 || word == 0xFF07 || word == 0xFF08
|| |
514 word == 0xFF09 || word == 0xFF0C || word == 0xFF0E || word == 0x
FF0F || | 514 word == 0xFF09 || word == 0xFF0C || word == 0xFF0E || word == 0x
FF0F || |
515 word == 0xFF1A || word == 0xFF1B || word == 0xFF1F || word == 0x
FF3B || | 515 word == 0xFF1A || word == 0xFF1B || word == 0xFF1F || word == 0x
FF3B || |
516 word == 0xFF3D || word == 0xFF40 || word == 0xFF5B || word == 0x
FF5C || | 516 word == 0xFF3D || word == 0xFF40 || word == 0xFF5B || word == 0x
FF5C || |
517 word == 0xFF5D || word == 0xFF61 || word == 0xFF62 || word == 0x
FF63 || | 517 word == 0xFF5D || word == 0xFF61 || word == 0xFF62 || word == 0x
FF63 || |
518 word == 0xFF64 || word == 0xFF65 || word == 0xFF9E || word == 0x
FF9F) { | 518 word == 0xFF64 || word == 0xFF65 || word == 0xFF9E || word == 0x
FF9F) { |
519 return TRUE; | 519 return true; |
520 } | 520 } |
521 } | 521 } |
522 return FALSE; | 522 return false; |
523 } | 523 } |
524 static FX_BOOL IsConnectiveSymbol(FX_DWORD word) | 524 static bool IsConnectiveSymbol(FX_DWORD word) |
525 { | 525 { |
526 if (word <= 0x007F) { | 526 if (word <= 0x007F) { |
527 if ((special_chars[word] >> 5) & 1) { | 527 if ((special_chars[word] >> 5) & 1) { |
528 return TRUE; | 528 return true; |
529 } | 529 } |
530 } | 530 } |
531 return FALSE; | 531 return false; |
532 } | 532 } |
533 static FX_BOOL IsOpenStylePunctuation(FX_DWORD word) | 533 static bool IsOpenStylePunctuation(FX_DWORD word) |
534 { | 534 { |
535 if (word <= 0x007F) { | 535 if (word <= 0x007F) { |
536 if ((special_chars[word] >> 2) & 1) { | 536 if ((special_chars[word] >> 2) & 1) { |
537 return TRUE; | 537 return true; |
538 } | 538 } |
539 } else if (word == 0x300A || word == 0x300C || word == 0x300E || word == 0x3
010 || | 539 } else if (word == 0x300A || word == 0x300C || word == 0x300E || word == 0x3
010 || |
540 word == 0x3014 || word == 0x3016 || word == 0x3018 || word == 0x3
01A || | 540 word == 0x3014 || word == 0x3016 || word == 0x3018 || word == 0x3
01A || |
541 word == 0xFF08 || word == 0xFF3B || word == 0xFF5B || word == 0xF
F62) { | 541 word == 0xFF08 || word == 0xFF3B || word == 0xFF5B || word == 0xF
F62) { |
542 return TRUE; | 542 return true; |
543 } | 543 } |
544 return FALSE; | 544 return false; |
545 } | 545 } |
546 static FX_BOOL IsCurrencySymbol(FX_WORD word) | 546 static bool IsCurrencySymbol(FX_WORD word) |
547 { | 547 { |
548 if (word == 0x0024 || word == 0x0080 || word == 0x00A2 || word == 0x00A3 || | 548 if (word == 0x0024 || word == 0x0080 || word == 0x00A2 || word == 0x00A3 || |
549 word == 0x00A4 || word == 0x00A5 || (word >= 0x20A0 && word <= 0x20C
F) || | 549 word == 0x00A4 || word == 0x00A5 || (word >= 0x20A0 && word <= 0x20C
F) || |
550 word == 0xFE69 || word == 0xFF04 || word == 0xFFE0 || word == 0xFFE1
|| | 550 word == 0xFE69 || word == 0xFF04 || word == 0xFFE0 || word == 0xFFE1
|| |
551 word == 0xFFE5 || word == 0xFFE6) { | 551 word == 0xFFE5 || word == 0xFFE6) { |
552 return TRUE; | 552 return true; |
553 } | 553 } |
554 return FALSE; | 554 return false; |
555 } | 555 } |
556 static FX_BOOL IsPrefixSymbol(FX_WORD word) | 556 static bool IsPrefixSymbol(FX_WORD word) |
557 { | 557 { |
558 if (IsCurrencySymbol(word)) { | 558 if (IsCurrencySymbol(word)) { |
559 return TRUE; | 559 return true; |
560 } | 560 } |
561 if (word == 0x2116) { | 561 if (word == 0x2116) { |
562 return TRUE; | 562 return true; |
563 } | 563 } |
564 return FALSE; | 564 return false; |
565 } | 565 } |
566 static FX_BOOL IsSpace(FX_WORD word) | 566 static bool IsSpace(FX_WORD word) |
567 { | 567 { |
568 return (word == 0x0020 || word == 0x3000) ? TRUE : FALSE; | 568 return (word == 0x0020 || word == 0x3000) ? true : false; |
569 } | 569 } |
570 static FX_BOOL NeedDivision(FX_WORD prevWord, FX_WORD curWord) | 570 static bool NeedDivision(FX_WORD prevWord, FX_WORD curWord) |
571 { | 571 { |
572 if ((IsLatin(prevWord) || IsDigit(prevWord)) && (IsLatin(curWord) || IsDigit
(curWord))) { | 572 if ((IsLatin(prevWord) || IsDigit(prevWord)) && (IsLatin(curWord) || IsDigit
(curWord))) { |
573 return FALSE; | 573 return false; |
574 } else if (IsSpace(curWord) || IsPunctuation(curWord)) { | 574 } else if (IsSpace(curWord) || IsPunctuation(curWord)) { |
575 return FALSE; | 575 return false; |
576 } else if (IsConnectiveSymbol(prevWord) || IsConnectiveSymbol(curWord)) { | 576 } else if (IsConnectiveSymbol(prevWord) || IsConnectiveSymbol(curWord)) { |
577 return FALSE; | 577 return false; |
578 } else if (IsSpace(prevWord) || IsPunctuation(prevWord)) { | 578 } else if (IsSpace(prevWord) || IsPunctuation(prevWord)) { |
579 return TRUE; | 579 return true; |
580 } else if (IsPrefixSymbol(prevWord)) { | 580 } else if (IsPrefixSymbol(prevWord)) { |
581 return FALSE; | 581 return false; |
582 } else if (IsPrefixSymbol(curWord) || IsCJK(curWord)) { | 582 } else if (IsPrefixSymbol(curWord) || IsCJK(curWord)) { |
583 return TRUE; | 583 return true; |
584 } else if (IsCJK(prevWord)) { | 584 } else if (IsCJK(prevWord)) { |
585 return TRUE; | 585 return true; |
586 } | 586 } |
587 return FALSE; | 587 return false; |
588 } | 588 } |
589 void CTypeset::SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize) | 589 void CTypeset::SplitLines(bool bTypeset, FX_FLOAT fFontSize) |
590 { | 590 { |
591 ASSERT(m_pVT != NULL); | 591 ASSERT(m_pVT != NULL); |
592 ASSERT(m_pSection != NULL); | 592 ASSERT(m_pSection != NULL); |
593 int32_t nLineHead = 0; | 593 int32_t nLineHead = 0; |
594 int32_t nLineTail = 0; | 594 int32_t nLineTail = 0; |
595 FX_FLOAT fMaxX = 0.0f, fMaxY = 0.0f; | 595 FX_FLOAT fMaxX = 0.0f, fMaxY = 0.0f; |
596 FX_FLOAT fLineWidth = 0.0f, fBackupLineWidth = 0.0f; | 596 FX_FLOAT fLineWidth = 0.0f, fBackupLineWidth = 0.0f; |
597 FX_FLOAT fLineAscent = 0.0f, fBackupLineAscent = 0.0f; | 597 FX_FLOAT fLineAscent = 0.0f, fBackupLineAscent = 0.0f; |
598 FX_FLOAT fLineDescent = 0.0f, fBackupLineDescent = 0.0f; | 598 FX_FLOAT fLineDescent = 0.0f, fBackupLineDescent = 0.0f; |
599 int32_t nWordStartPos = 0; | 599 int32_t nWordStartPos = 0; |
600 FX_BOOL bFullWord = FALSE; | 600 bool bFullWord = false; |
601 int32_t nLineFullWordIndex = 0; | 601 int32_t nLineFullWordIndex = 0; |
602 int32_t nCharIndex = 0; | 602 int32_t nCharIndex = 0; |
603 CPVT_LineInfo line; | 603 CPVT_LineInfo line; |
604 FX_FLOAT fWordWidth = 0; | 604 FX_FLOAT fWordWidth = 0; |
605 FX_FLOAT fTypesetWidth = FPDF_MAX(m_pVT->GetPlateWidth() - m_pVT->GetLineInd
ent(m_pSection->m_SecInfo), 0.0f); | 605 FX_FLOAT fTypesetWidth = FPDF_MAX(m_pVT->GetPlateWidth() - m_pVT->GetLineInd
ent(m_pSection->m_SecInfo), 0.0f); |
606 int32_t nTotalWords = m_pSection->m_WordArray.GetSize(); | 606 int32_t nTotalWords = m_pSection->m_WordArray.GetSize(); |
607 FX_BOOL bOpened = FALSE; | 607 bool bOpened = false; |
608 if (nTotalWords > 0) { | 608 if (nTotalWords > 0) { |
609 int32_t i = 0; | 609 int32_t i = 0; |
610 while (i < nTotalWords) { | 610 while (i < nTotalWords) { |
611 CPVT_WordInfo * pWord = m_pSection->m_WordArray.GetAt(i); | 611 CPVT_WordInfo * pWord = m_pSection->m_WordArray.GetAt(i); |
612 CPVT_WordInfo* pOldWord = pWord; | 612 CPVT_WordInfo* pOldWord = pWord; |
613 if (i > 0) { | 613 if (i > 0) { |
614 pOldWord = m_pSection->m_WordArray.GetAt(i - 1); | 614 pOldWord = m_pSection->m_WordArray.GetAt(i - 1); |
615 } | 615 } |
616 if (pWord) { | 616 if (pWord) { |
617 if (bTypeset) { | 617 if (bTypeset) { |
618 fLineAscent = FPDF_MAX(fLineAscent, m_pVT->GetWordAscent(*pW
ord, TRUE)); | 618 fLineAscent = FPDF_MAX(fLineAscent, m_pVT->GetWordAscent(*pW
ord, true)); |
619 fLineDescent = FPDF_MIN(fLineDescent, m_pVT->GetWordDescent(
*pWord, TRUE)); | 619 fLineDescent = FPDF_MIN(fLineDescent, m_pVT->GetWordDescent(
*pWord, true)); |
620 fWordWidth = m_pVT->GetWordWidth(*pWord); | 620 fWordWidth = m_pVT->GetWordWidth(*pWord); |
621 } else { | 621 } else { |
622 fLineAscent = FPDF_MAX(fLineAscent, m_pVT->GetWordAscent(*pW
ord, fFontSize)); | 622 fLineAscent = FPDF_MAX(fLineAscent, m_pVT->GetWordAscent(*pW
ord, fFontSize)); |
623 fLineDescent = FPDF_MIN(fLineDescent, m_pVT->GetWordDescent(
*pWord, fFontSize)); | 623 fLineDescent = FPDF_MIN(fLineDescent, m_pVT->GetWordDescent(
*pWord, fFontSize)); |
624 fWordWidth = m_pVT->GetWordWidth(pWord->nFontIndex, | 624 fWordWidth = m_pVT->GetWordWidth(pWord->nFontIndex, |
625 pWord->Word, | 625 pWord->Word, |
626 m_pVT->m_wSubWord, | 626 m_pVT->m_wSubWord, |
627 m_pVT->m_fCharSpace, | 627 m_pVT->m_fCharSpace, |
628 m_pVT->m_nHorzScale, | 628 m_pVT->m_nHorzScale, |
629 fFontSize, | 629 fFontSize, |
630 pWord->fWordTail, | 630 pWord->fWordTail, |
631 0); | 631 0); |
632 } | 632 } |
633 if (!bOpened) { | 633 if (!bOpened) { |
634 if (IsOpenStylePunctuation(pWord->Word)) { | 634 if (IsOpenStylePunctuation(pWord->Word)) { |
635 bOpened = TRUE; | 635 bOpened = true; |
636 bFullWord = TRUE; | 636 bFullWord = true; |
637 } else if (pOldWord != NULL) { | 637 } else if (pOldWord != NULL) { |
638 if (NeedDivision(pOldWord->Word, pWord->Word)) { | 638 if (NeedDivision(pOldWord->Word, pWord->Word)) { |
639 bFullWord = TRUE; | 639 bFullWord = true; |
640 } | 640 } |
641 } | 641 } |
642 } else { | 642 } else { |
643 if (!IsSpace(pWord->Word) && !IsOpenStylePunctuation(pWord->
Word)) { | 643 if (!IsSpace(pWord->Word) && !IsOpenStylePunctuation(pWord->
Word)) { |
644 bOpened = FALSE; | 644 bOpened = false; |
645 } | 645 } |
646 } | 646 } |
647 if (bFullWord) { | 647 if (bFullWord) { |
648 bFullWord = FALSE; | 648 bFullWord = false; |
649 if (nCharIndex > 0) { | 649 if (nCharIndex > 0) { |
650 nLineFullWordIndex ++; | 650 nLineFullWordIndex ++; |
651 } | 651 } |
652 nWordStartPos = i; | 652 nWordStartPos = i; |
653 fBackupLineWidth = fLineWidth; | 653 fBackupLineWidth = fLineWidth; |
654 fBackupLineAscent = fLineAscent; | 654 fBackupLineAscent = fLineAscent; |
655 fBackupLineDescent = fLineDescent; | 655 fBackupLineDescent = fLineDescent; |
656 } | 656 } |
657 nCharIndex++; | 657 nCharIndex++; |
658 } | 658 } |
(...skipping 21 matching lines...) Expand all Loading... |
680 } | 680 } |
681 fMaxY += (fLineAscent + m_pVT->GetLineLeading(m_pSection->m_SecI
nfo)); | 681 fMaxY += (fLineAscent + m_pVT->GetLineLeading(m_pSection->m_SecI
nfo)); |
682 fMaxY += (-fLineDescent); | 682 fMaxY += (-fLineDescent); |
683 fMaxX = FPDF_MAX(fLineWidth, fMaxX); | 683 fMaxX = FPDF_MAX(fLineWidth, fMaxX); |
684 nLineHead = i; | 684 nLineHead = i; |
685 fLineWidth = 0.0f; | 685 fLineWidth = 0.0f; |
686 fLineAscent = 0.0f; | 686 fLineAscent = 0.0f; |
687 fLineDescent = 0.0f; | 687 fLineDescent = 0.0f; |
688 nCharIndex = 0; | 688 nCharIndex = 0; |
689 nLineFullWordIndex = 0; | 689 nLineFullWordIndex = 0; |
690 bFullWord = FALSE; | 690 bFullWord = false; |
691 } else { | 691 } else { |
692 fLineWidth += fWordWidth; | 692 fLineWidth += fWordWidth; |
693 i++; | 693 i++; |
694 } | 694 } |
695 } | 695 } |
696 if (nLineHead <= nTotalWords - 1) { | 696 if (nLineHead <= nTotalWords - 1) { |
697 nLineTail = nTotalWords - 1; | 697 nLineTail = nTotalWords - 1; |
698 if (bTypeset) { | 698 if (bTypeset) { |
699 line.nBeginWordIndex = nLineHead; | 699 line.nBeginWordIndex = nLineHead; |
700 line.nEndWordIndex = nLineTail; | 700 line.nEndWordIndex = nLineTail; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 } | 798 } |
799 fPosY += (-pLine->m_LineInfo.fLineDescent); | 799 fPosY += (-pLine->m_LineInfo.fLineDescent); |
800 } | 800 } |
801 } | 801 } |
802 } | 802 } |
803 m_rcRet = CPVT_FloatRect(fMinX, fMinY, fMaxX, fMaxY); | 803 m_rcRet = CPVT_FloatRect(fMinX, fMinY, fMaxX, fMaxY); |
804 } | 804 } |
805 CPDF_VariableText::CPDF_VariableText() : | 805 CPDF_VariableText::CPDF_VariableText() : |
806 m_nLimitChar(0), | 806 m_nLimitChar(0), |
807 m_nCharArray(0), | 807 m_nCharArray(0), |
808 m_bMultiLine(FALSE), | 808 m_bMultiLine(false), |
809 m_bLimitWidth(FALSE), | 809 m_bLimitWidth(false), |
810 m_bAutoFontSize(FALSE), | 810 m_bAutoFontSize(false), |
811 m_nAlignment(0), | 811 m_nAlignment(0), |
812 m_fLineLeading(0.0f), | 812 m_fLineLeading(0.0f), |
813 m_fCharSpace(0.0f), | 813 m_fCharSpace(0.0f), |
814 m_nHorzScale(100), | 814 m_nHorzScale(100), |
815 m_wSubWord(0), | 815 m_wSubWord(0), |
816 m_fFontSize(0.0f), | 816 m_fFontSize(0.0f), |
817 m_bInitial(FALSE), | 817 m_bInitial(false), |
818 m_bRichText(FALSE), | 818 m_bRichText(false), |
819 m_pVTProvider(NULL), | 819 m_pVTProvider(NULL), |
820 m_pVTIterator(NULL) | 820 m_pVTIterator(NULL) |
821 { | 821 { |
822 } | 822 } |
823 CPDF_VariableText::~CPDF_VariableText() | 823 CPDF_VariableText::~CPDF_VariableText() |
824 { | 824 { |
825 delete m_pVTIterator; | 825 delete m_pVTIterator; |
826 m_pVTIterator = NULL; | 826 m_pVTIterator = NULL; |
827 ResetAll(); | 827 ResetAll(); |
828 } | 828 } |
829 void CPDF_VariableText::Initialize() | 829 void CPDF_VariableText::Initialize() |
830 { | 830 { |
831 if (!m_bInitial) { | 831 if (!m_bInitial) { |
832 CPVT_SectionInfo secinfo; | 832 CPVT_SectionInfo secinfo; |
833 if (m_bRichText) { | 833 if (m_bRichText) { |
834 secinfo.pSecProps = new CPVT_SecProps(0.0f, 0.0f, 0); | 834 secinfo.pSecProps = new CPVT_SecProps(0.0f, 0.0f, 0); |
835 secinfo.pWordProps = new CPVT_WordProps(GetDefaultFontIndex(), PVT_D
EFAULT_FONTSIZE, 0, 0, 0); | 835 secinfo.pWordProps = new CPVT_WordProps(GetDefaultFontIndex(), PVT_D
EFAULT_FONTSIZE, 0, 0, 0); |
836 } | 836 } |
837 CPVT_WordPlace place; | 837 CPVT_WordPlace place; |
838 place.nSecIndex = 0; | 838 place.nSecIndex = 0; |
839 AddSection(place, secinfo); | 839 AddSection(place, secinfo); |
840 CPVT_LineInfo lineinfo; | 840 CPVT_LineInfo lineinfo; |
841 lineinfo.fLineAscent = GetFontAscent(GetDefaultFontIndex(), GetFontSize(
)); | 841 lineinfo.fLineAscent = GetFontAscent(GetDefaultFontIndex(), GetFontSize(
)); |
842 lineinfo.fLineDescent = GetFontDescent(GetDefaultFontIndex(), GetFontSiz
e()); | 842 lineinfo.fLineDescent = GetFontDescent(GetDefaultFontIndex(), GetFontSiz
e()); |
843 AddLine(place, lineinfo); | 843 AddLine(place, lineinfo); |
844 if (CSection * pSection = m_SectionArray.GetAt(0)) { | 844 if (CSection * pSection = m_SectionArray.GetAt(0)) { |
845 pSection->ResetLinePlace(); | 845 pSection->ResetLinePlace(); |
846 } | 846 } |
847 m_bInitial = TRUE; | 847 m_bInitial = true; |
848 } | 848 } |
849 } | 849 } |
850 void CPDF_VariableText::ResetAll() | 850 void CPDF_VariableText::ResetAll() |
851 { | 851 { |
852 m_bInitial = FALSE; | 852 m_bInitial = false; |
853 ResetSectionArray(); | 853 ResetSectionArray(); |
854 } | 854 } |
855 CPVT_WordPlace CPDF_VariableText::InsertWord(const CPVT_WordPlace & place, FX_WO
RD word, int32_t charset, | 855 CPVT_WordPlace CPDF_VariableText::InsertWord(const CPVT_WordPlace & place, FX_WO
RD word, int32_t charset, |
856 const CPVT_WordProps * pWordProps) | 856 const CPVT_WordProps * pWordProps) |
857 { | 857 { |
858 int32_t nTotlaWords = GetTotalWords(); | 858 int32_t nTotlaWords = GetTotalWords(); |
859 if (m_nLimitChar > 0 && nTotlaWords >= m_nLimitChar) { | 859 if (m_nLimitChar > 0 && nTotlaWords >= m_nLimitChar) { |
860 return place; | 860 return place; |
861 } | 861 } |
862 if (m_nCharArray > 0 && nTotlaWords >= m_nCharArray) { | 862 if (m_nCharArray > 0 && nTotlaWords >= m_nCharArray) { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 break; | 947 break; |
948 } | 948 } |
949 if (wp == oldwp) { | 949 if (wp == oldwp) { |
950 break; | 950 break; |
951 } | 951 } |
952 } | 952 } |
953 return wp; | 953 return wp; |
954 } | 954 } |
955 CPVT_WordPlace CPDF_VariableText::DeleteWords(const CPVT_WordRange & PlaceRange) | 955 CPVT_WordPlace CPDF_VariableText::DeleteWords(const CPVT_WordRange & PlaceRange) |
956 { | 956 { |
957 FX_BOOL bLastSecPos = FALSE; | 957 bool bLastSecPos = false; |
958 if (CSection * pSection = m_SectionArray.GetAt(PlaceRange.EndPos.nSecIndex))
{ | 958 if (CSection * pSection = m_SectionArray.GetAt(PlaceRange.EndPos.nSecIndex))
{ |
959 bLastSecPos = (PlaceRange.EndPos == pSection->GetEndWordPlace()); | 959 bLastSecPos = (PlaceRange.EndPos == pSection->GetEndWordPlace()); |
960 } | 960 } |
961 ClearWords(PlaceRange); | 961 ClearWords(PlaceRange); |
962 if (PlaceRange.BeginPos.nSecIndex != PlaceRange.EndPos.nSecIndex) { | 962 if (PlaceRange.BeginPos.nSecIndex != PlaceRange.EndPos.nSecIndex) { |
963 ClearEmptySections(PlaceRange); | 963 ClearEmptySections(PlaceRange); |
964 if (!bLastSecPos) { | 964 if (!bLastSecPos) { |
965 LinkLatterSection(PlaceRange.BeginPos); | 965 LinkLatterSection(PlaceRange.BeginPos); |
966 } | 966 } |
967 } | 967 } |
968 return PlaceRange.BeginPos; | 968 return PlaceRange.BeginPos; |
969 } | 969 } |
970 CPVT_WordPlace CPDF_VariableText::DeleteWord(const CPVT_WordPlace & place) | 970 CPVT_WordPlace CPDF_VariableText::DeleteWord(const CPVT_WordPlace & place) |
971 { | 971 { |
972 return ClearRightWord(AjustLineHeader(place, TRUE)); | 972 return ClearRightWord(AjustLineHeader(place, true)); |
973 } | 973 } |
974 CPVT_WordPlace CPDF_VariableText::BackSpaceWord(const CPVT_WordPlace & place) | 974 CPVT_WordPlace CPDF_VariableText::BackSpaceWord(const CPVT_WordPlace & place) |
975 { | 975 { |
976 return ClearLeftWord(AjustLineHeader(place, TRUE)); | 976 return ClearLeftWord(AjustLineHeader(place, true)); |
977 } | 977 } |
978 void CPDF_VariableText::SetText(const FX_WCHAR* text, int32_t charset, const CPV
T_SecProps * pSecProps, | 978 void CPDF_VariableText::SetText(const FX_WCHAR* text, int32_t charset, const CPV
T_SecProps * pSecProps, |
979 const CPVT_WordProps * pWordProps) | 979 const CPVT_WordProps * pWordProps) |
980 { | 980 { |
981 DeleteWords(CPVT_WordRange(GetBeginWordPlace(), GetEndWordPlace())); | 981 DeleteWords(CPVT_WordRange(GetBeginWordPlace(), GetEndWordPlace())); |
982 CFX_WideString swText = text; | 982 CFX_WideString swText = text; |
983 CPVT_WordPlace wp(0, 0, -1); | 983 CPVT_WordPlace wp(0, 0, -1); |
984 CPVT_SectionInfo secinfo; | 984 CPVT_SectionInfo secinfo; |
985 if (m_bRichText) { | 985 if (m_bRichText) { |
986 if (pSecProps) { | 986 if (pSecProps) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 } | 1035 } |
1036 } | 1036 } |
1037 void CPDF_VariableText::UpdateWordPlace(CPVT_WordPlace & place) const | 1037 void CPDF_VariableText::UpdateWordPlace(CPVT_WordPlace & place) const |
1038 { | 1038 { |
1039 if (place.nSecIndex < 0) { | 1039 if (place.nSecIndex < 0) { |
1040 place = GetBeginWordPlace(); | 1040 place = GetBeginWordPlace(); |
1041 } | 1041 } |
1042 if (place.nSecIndex >= m_SectionArray.GetSize()) { | 1042 if (place.nSecIndex >= m_SectionArray.GetSize()) { |
1043 place = GetEndWordPlace(); | 1043 place = GetEndWordPlace(); |
1044 } | 1044 } |
1045 place = AjustLineHeader(place, TRUE); | 1045 place = AjustLineHeader(place, true); |
1046 if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) { | 1046 if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) { |
1047 pSection->UpdateWordPlace(place); | 1047 pSection->UpdateWordPlace(place); |
1048 } | 1048 } |
1049 } | 1049 } |
1050 int32_t CPDF_VariableText::WordPlaceToWordIndex(const CPVT_WordPlace & place) co
nst | 1050 int32_t CPDF_VariableText::WordPlaceToWordIndex(const CPVT_WordPlace & place) co
nst |
1051 { | 1051 { |
1052 CPVT_WordPlace newplace = place; | 1052 CPVT_WordPlace newplace = place; |
1053 UpdateWordPlace(newplace); | 1053 UpdateWordPlace(newplace); |
1054 int32_t nIndex = 0; | 1054 int32_t nIndex = 0; |
1055 int32_t i = 0; | 1055 int32_t i = 0; |
1056 int32_t sz = 0; | 1056 int32_t sz = 0; |
1057 for (i = 0, sz = m_SectionArray.GetSize(); i < sz && i < newplace.nSecIndex;
i++) { | 1057 for (i = 0, sz = m_SectionArray.GetSize(); i < sz && i < newplace.nSecIndex;
i++) { |
1058 if (CSection * pSection = m_SectionArray.GetAt(i)) { | 1058 if (CSection * pSection = m_SectionArray.GetAt(i)) { |
1059 nIndex += pSection->m_WordArray.GetSize(); | 1059 nIndex += pSection->m_WordArray.GetSize(); |
1060 if (i != m_SectionArray.GetSize() - 1) { | 1060 if (i != m_SectionArray.GetSize() - 1) { |
1061 nIndex += PVT_RETURN_LENGTH; | 1061 nIndex += PVT_RETURN_LENGTH; |
1062 } | 1062 } |
1063 } | 1063 } |
1064 } | 1064 } |
1065 if (i >= 0 && i < m_SectionArray.GetSize()) { | 1065 if (i >= 0 && i < m_SectionArray.GetSize()) { |
1066 nIndex += newplace.nWordIndex + PVT_RETURN_LENGTH; | 1066 nIndex += newplace.nWordIndex + PVT_RETURN_LENGTH; |
1067 } | 1067 } |
1068 return nIndex; | 1068 return nIndex; |
1069 } | 1069 } |
1070 CPVT_WordPlace CPDF_VariableText::WordIndexToWordPlace(int32_t index) const | 1070 CPVT_WordPlace CPDF_VariableText::WordIndexToWordPlace(int32_t index) const |
1071 { | 1071 { |
1072 CPVT_WordPlace place = GetBeginWordPlace(); | 1072 CPVT_WordPlace place = GetBeginWordPlace(); |
1073 int32_t nOldIndex = 0 , nIndex = 0; | 1073 int32_t nOldIndex = 0 , nIndex = 0; |
1074 FX_BOOL bFind = FALSE; | 1074 bool bFind = false; |
1075 for (int32_t i = 0, sz = m_SectionArray.GetSize(); i < sz; i++) { | 1075 for (int32_t i = 0, sz = m_SectionArray.GetSize(); i < sz; i++) { |
1076 if (CSection * pSection = m_SectionArray.GetAt(i)) { | 1076 if (CSection * pSection = m_SectionArray.GetAt(i)) { |
1077 nIndex += pSection->m_WordArray.GetSize(); | 1077 nIndex += pSection->m_WordArray.GetSize(); |
1078 if (nIndex == index) { | 1078 if (nIndex == index) { |
1079 place = pSection->GetEndWordPlace(); | 1079 place = pSection->GetEndWordPlace(); |
1080 bFind = TRUE; | 1080 bFind = true; |
1081 break; | 1081 break; |
1082 } else if (nIndex > index) { | 1082 } else if (nIndex > index) { |
1083 place.nSecIndex = i; | 1083 place.nSecIndex = i; |
1084 place.nWordIndex = index - nOldIndex - 1; | 1084 place.nWordIndex = index - nOldIndex - 1; |
1085 pSection->UpdateWordPlace(place); | 1085 pSection->UpdateWordPlace(place); |
1086 bFind = TRUE; | 1086 bFind = true; |
1087 break; | 1087 break; |
1088 } | 1088 } |
1089 if (i != m_SectionArray.GetSize() - 1) { | 1089 if (i != m_SectionArray.GetSize() - 1) { |
1090 nIndex += PVT_RETURN_LENGTH; | 1090 nIndex += PVT_RETURN_LENGTH; |
1091 } | 1091 } |
1092 nOldIndex = nIndex; | 1092 nOldIndex = nIndex; |
1093 } | 1093 } |
1094 } | 1094 } |
1095 if (!bFind) { | 1095 if (!bFind) { |
1096 place = GetEndWordPlace(); | 1096 place = GetEndWordPlace(); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 } | 1150 } |
1151 return place; | 1151 return place; |
1152 } | 1152 } |
1153 CPVT_WordPlace CPDF_VariableText::SearchWordPlace(const CPDF_Point & point) cons
t | 1153 CPVT_WordPlace CPDF_VariableText::SearchWordPlace(const CPDF_Point & point) cons
t |
1154 { | 1154 { |
1155 CPDF_Point pt = OutToIn(point); | 1155 CPDF_Point pt = OutToIn(point); |
1156 CPVT_WordPlace place = GetBeginWordPlace(); | 1156 CPVT_WordPlace place = GetBeginWordPlace(); |
1157 int32_t nLeft = 0; | 1157 int32_t nLeft = 0; |
1158 int32_t nRight = m_SectionArray.GetSize() - 1; | 1158 int32_t nRight = m_SectionArray.GetSize() - 1; |
1159 int32_t nMid = m_SectionArray.GetSize() / 2; | 1159 int32_t nMid = m_SectionArray.GetSize() / 2; |
1160 FX_BOOL bUp = TRUE; | 1160 bool bUp = true; |
1161 FX_BOOL bDown = TRUE; | 1161 bool bDown = true; |
1162 while (nLeft <= nRight) { | 1162 while (nLeft <= nRight) { |
1163 if (CSection * pSection = m_SectionArray.GetAt(nMid)) { | 1163 if (CSection * pSection = m_SectionArray.GetAt(nMid)) { |
1164 if (IsFloatBigger(pt.y, pSection->m_SecInfo.rcSection.top)) { | 1164 if (IsFloatBigger(pt.y, pSection->m_SecInfo.rcSection.top)) { |
1165 bUp = FALSE; | 1165 bUp = false; |
1166 } | 1166 } |
1167 if (IsFloatBigger(pSection->m_SecInfo.rcSection.bottom, pt.y)) { | 1167 if (IsFloatBigger(pSection->m_SecInfo.rcSection.bottom, pt.y)) { |
1168 bDown = FALSE; | 1168 bDown = false; |
1169 } | 1169 } |
1170 if (IsFloatSmaller(pt.y, pSection->m_SecInfo.rcSection.top)) { | 1170 if (IsFloatSmaller(pt.y, pSection->m_SecInfo.rcSection.top)) { |
1171 nRight = nMid - 1; | 1171 nRight = nMid - 1; |
1172 nMid = (nLeft + nRight) / 2; | 1172 nMid = (nLeft + nRight) / 2; |
1173 continue; | 1173 continue; |
1174 } else if (IsFloatBigger(pt.y, pSection->m_SecInfo.rcSection.bottom)
) { | 1174 } else if (IsFloatBigger(pt.y, pSection->m_SecInfo.rcSection.bottom)
) { |
1175 nLeft = nMid + 1; | 1175 nLeft = nMid + 1; |
1176 nMid = (nLeft + nRight) / 2; | 1176 nMid = (nLeft + nRight) / 2; |
1177 continue; | 1177 continue; |
1178 } else { | 1178 } else { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1300 if (m_SectionArray.GetSize() <= 0) { | 1300 if (m_SectionArray.GetSize() <= 0) { |
1301 return place; | 1301 return place; |
1302 } | 1302 } |
1303 CPVT_WordPlace newplace = place; | 1303 CPVT_WordPlace newplace = place; |
1304 newplace.nSecIndex = FPDF_MAX(FPDF_MIN(newplace.nSecIndex, m_SectionArray.Ge
tSize() - 1), 0); | 1304 newplace.nSecIndex = FPDF_MAX(FPDF_MIN(newplace.nSecIndex, m_SectionArray.Ge
tSize() - 1), 0); |
1305 if (CSection * pSection = m_SectionArray.GetAt(newplace.nSecIndex)) { | 1305 if (CSection * pSection = m_SectionArray.GetAt(newplace.nSecIndex)) { |
1306 return pSection->AddWord(newplace, wordinfo); | 1306 return pSection->AddWord(newplace, wordinfo); |
1307 } | 1307 } |
1308 return place; | 1308 return place; |
1309 } | 1309 } |
1310 FX_BOOL CPDF_VariableText::GetWordInfo(const CPVT_WordPlace & place, CPVT_WordIn
fo & wordinfo) | 1310 bool CPDF_VariableText::GetWordInfo(const CPVT_WordPlace & place, CPVT_WordInfo
& wordinfo) |
1311 { | 1311 { |
1312 if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) { | 1312 if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) { |
1313 if (CPVT_WordInfo * pWord = pSection->m_WordArray.GetAt(place.nWordIndex
)) { | 1313 if (CPVT_WordInfo * pWord = pSection->m_WordArray.GetAt(place.nWordIndex
)) { |
1314 wordinfo = *pWord; | 1314 wordinfo = *pWord; |
1315 return TRUE; | 1315 return true; |
1316 } | 1316 } |
1317 } | 1317 } |
1318 return FALSE; | 1318 return false; |
1319 } | 1319 } |
1320 FX_BOOL CPDF_VariableText::SetWordInfo(const CPVT_WordPlace & place, const CPVT_
WordInfo & wordinfo) | 1320 bool CPDF_VariableText::SetWordInfo(const CPVT_WordPlace & place, const CPVT_Wor
dInfo & wordinfo) |
1321 { | 1321 { |
1322 if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) { | 1322 if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) { |
1323 if (CPVT_WordInfo * pWord = pSection->m_WordArray.GetAt(place.nWordIndex
)) { | 1323 if (CPVT_WordInfo * pWord = pSection->m_WordArray.GetAt(place.nWordIndex
)) { |
1324 *pWord = wordinfo; | 1324 *pWord = wordinfo; |
1325 return TRUE; | 1325 return true; |
1326 } | 1326 } |
1327 } | 1327 } |
1328 return FALSE; | 1328 return false; |
1329 } | 1329 } |
1330 FX_BOOL CPDF_VariableText::GetLineInfo(const CPVT_WordPlace & place, CPVT_LineIn
fo & lineinfo) | 1330 bool CPDF_VariableText::GetLineInfo(const CPVT_WordPlace & place, CPVT_LineInfo
& lineinfo) |
1331 { | 1331 { |
1332 if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) { | 1332 if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) { |
1333 if (CLine * pLine = pSection->m_LineArray.GetAt(place.nLineIndex)) { | 1333 if (CLine * pLine = pSection->m_LineArray.GetAt(place.nLineIndex)) { |
1334 lineinfo = pLine->m_LineInfo; | 1334 lineinfo = pLine->m_LineInfo; |
1335 return TRUE; | 1335 return true; |
1336 } | 1336 } |
1337 } | 1337 } |
1338 return FALSE; | 1338 return false; |
1339 } | 1339 } |
1340 FX_BOOL CPDF_VariableText::GetSectionInfo(const CPVT_WordPlace & place, CPVT_Sec
tionInfo & secinfo) | 1340 bool CPDF_VariableText::GetSectionInfo(const CPVT_WordPlace & place, CPVT_Sectio
nInfo & secinfo) |
1341 { | 1341 { |
1342 if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) { | 1342 if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) { |
1343 secinfo = pSection->m_SecInfo; | 1343 secinfo = pSection->m_SecInfo; |
1344 return TRUE; | 1344 return true; |
1345 } | 1345 } |
1346 return FALSE; | 1346 return false; |
1347 } | 1347 } |
1348 CPDF_Rect CPDF_VariableText::GetContentRect() const | 1348 CPDF_Rect CPDF_VariableText::GetContentRect() const |
1349 { | 1349 { |
1350 return InToOut(CPDF_EditContainer::GetContentRect()); | 1350 return InToOut(CPDF_EditContainer::GetContentRect()); |
1351 } | 1351 } |
1352 FX_FLOAT CPDF_VariableText::GetWordFontSize(const CPVT_WordInfo & WordInfo, FX_B
OOL bFactFontSize) | 1352 FX_FLOAT CPDF_VariableText::GetWordFontSize(const CPVT_WordInfo & WordInfo, bool
bFactFontSize) |
1353 { | 1353 { |
1354 return m_bRichText && WordInfo.pWordProps ? (WordInfo.pWordProps->nScriptTyp
e == PVTWORD_SCRIPT_NORMAL || bFactFontSize ? WordInfo.pWordProps->fFontSize : W
ordInfo.pWordProps->fFontSize * PVT_HALF) : GetFontSize(); | 1354 return m_bRichText && WordInfo.pWordProps ? (WordInfo.pWordProps->nScriptTyp
e == PVTWORD_SCRIPT_NORMAL || bFactFontSize ? WordInfo.pWordProps->fFontSize : W
ordInfo.pWordProps->fFontSize * PVT_HALF) : GetFontSize(); |
1355 } | 1355 } |
1356 int32_t CPDF_VariableText::GetWordFontIndex(const CPVT_WordInfo & WordInfo) | 1356 int32_t CPDF_VariableText::GetWordFontIndex(const CPVT_WordInfo & WordInfo) |
1357 { | 1357 { |
1358 return m_bRichText && WordInfo.pWordProps ? WordInfo.pWordProps->nFontIndex
: WordInfo.nFontIndex; | 1358 return m_bRichText && WordInfo.pWordProps ? WordInfo.pWordProps->nFontIndex
: WordInfo.nFontIndex; |
1359 } | 1359 } |
1360 FX_FLOAT CPDF_VariableText::GetWordWidth(int32_t nFontIndex, FX_WORD Word, FX_WO
RD SubWord, | 1360 FX_FLOAT CPDF_VariableText::GetWordWidth(int32_t nFontIndex, FX_WORD Word, FX_WO
RD SubWord, |
1361 FX_FLOAT fCharSpace, int32_t nHorzScale, | 1361 FX_FLOAT fCharSpace, int32_t nHorzScale, |
1362 FX_FLOAT fFontSize, FX_FLOAT fWordTail, int32_t nWordStyle) | 1362 FX_FLOAT fFontSize, FX_FLOAT fWordTail, int32_t nWordStyle) |
(...skipping 25 matching lines...) Expand all Loading... |
1388 return (FX_FLOAT)GetTypeDescent(nFontIndex) * fFontSize * PVT_FONTSCALE; | 1388 return (FX_FLOAT)GetTypeDescent(nFontIndex) * fFontSize * PVT_FONTSCALE; |
1389 } | 1389 } |
1390 FX_FLOAT CPDF_VariableText::GetWordAscent(const CPVT_WordInfo & WordInfo, FX_FLO
AT fFontSize) | 1390 FX_FLOAT CPDF_VariableText::GetWordAscent(const CPVT_WordInfo & WordInfo, FX_FLO
AT fFontSize) |
1391 { | 1391 { |
1392 return GetFontAscent(GetWordFontIndex(WordInfo), fFontSize); | 1392 return GetFontAscent(GetWordFontIndex(WordInfo), fFontSize); |
1393 } | 1393 } |
1394 FX_FLOAT CPDF_VariableText::GetWordDescent(const CPVT_WordInfo & WordInfo, FX_FL
OAT fFontSize) | 1394 FX_FLOAT CPDF_VariableText::GetWordDescent(const CPVT_WordInfo & WordInfo, FX_FL
OAT fFontSize) |
1395 { | 1395 { |
1396 return GetFontDescent(GetWordFontIndex(WordInfo), fFontSize); | 1396 return GetFontDescent(GetWordFontIndex(WordInfo), fFontSize); |
1397 } | 1397 } |
1398 FX_FLOAT CPDF_VariableText::GetWordAscent(const CPVT_WordInfo & WordInfo, FX_BOO
L bFactFontSize) | 1398 FX_FLOAT CPDF_VariableText::GetWordAscent(const CPVT_WordInfo & WordInfo, bool b
FactFontSize) |
1399 { | 1399 { |
1400 return GetFontAscent(GetWordFontIndex(WordInfo), GetWordFontSize(WordInfo, b
FactFontSize)); | 1400 return GetFontAscent(GetWordFontIndex(WordInfo), GetWordFontSize(WordInfo, b
FactFontSize)); |
1401 } | 1401 } |
1402 FX_FLOAT CPDF_VariableText::GetWordDescent(const CPVT_WordInfo & WordInfo, FX_BO
OL bFactFontSize) | 1402 FX_FLOAT CPDF_VariableText::GetWordDescent(const CPVT_WordInfo & WordInfo, bool
bFactFontSize) |
1403 { | 1403 { |
1404 return GetFontDescent(GetWordFontIndex(WordInfo), GetWordFontSize(WordInfo,
bFactFontSize)); | 1404 return GetFontDescent(GetWordFontIndex(WordInfo), GetWordFontSize(WordInfo,
bFactFontSize)); |
1405 } | 1405 } |
1406 FX_FLOAT CPDF_VariableText::GetLineLeading(const CPVT_SectionInfo & SecInfo) | 1406 FX_FLOAT CPDF_VariableText::GetLineLeading(const CPVT_SectionInfo & SecInfo) |
1407 { | 1407 { |
1408 return m_bRichText && SecInfo.pSecProps ? SecInfo.pSecProps->fLineLeading :
m_fLineLeading; | 1408 return m_bRichText && SecInfo.pSecProps ? SecInfo.pSecProps->fLineLeading :
m_fLineLeading; |
1409 } | 1409 } |
1410 FX_FLOAT CPDF_VariableText::GetLineIndent(const CPVT_SectionInfo & SecInfo) | 1410 FX_FLOAT CPDF_VariableText::GetLineIndent(const CPVT_SectionInfo & SecInfo) |
1411 { | 1411 { |
1412 return m_bRichText && SecInfo.pSecProps ? SecInfo.pSecProps->fLineIndent : 0
.0f; | 1412 return m_bRichText && SecInfo.pSecProps ? SecInfo.pSecProps->fLineIndent : 0
.0f; |
1413 } | 1413 } |
1414 int32_t CPDF_VariableText::GetAlignment(const CPVT_SectionInfo& SecInfo) | 1414 int32_t CPDF_VariableText::GetAlignment(const CPVT_SectionInfo& SecInfo) |
1415 { | 1415 { |
1416 return m_bRichText && SecInfo.pSecProps ? SecInfo.pSecProps->nAlignment : m_
nAlignment; | 1416 return m_bRichText && SecInfo.pSecProps ? SecInfo.pSecProps->nAlignment : m_
nAlignment; |
1417 } | 1417 } |
1418 FX_FLOAT CPDF_VariableText::GetCharSpace(const CPVT_WordInfo & WordInfo) | 1418 FX_FLOAT CPDF_VariableText::GetCharSpace(const CPVT_WordInfo & WordInfo) |
1419 { | 1419 { |
1420 return m_bRichText && WordInfo.pWordProps ? WordInfo.pWordProps->fCharSpace
: m_fCharSpace; | 1420 return m_bRichText && WordInfo.pWordProps ? WordInfo.pWordProps->fCharSpace
: m_fCharSpace; |
1421 } | 1421 } |
1422 int32_t CPDF_VariableText::GetHorzScale(const CPVT_WordInfo & WordInfo) | 1422 int32_t CPDF_VariableText::GetHorzScale(const CPVT_WordInfo & WordInfo) |
1423 { | 1423 { |
1424 return m_bRichText && WordInfo.pWordProps ? WordInfo.pWordProps->nHorzScale
: m_nHorzScale; | 1424 return m_bRichText && WordInfo.pWordProps ? WordInfo.pWordProps->nHorzScale
: m_nHorzScale; |
1425 } | 1425 } |
1426 void CPDF_VariableText::ClearSectionRightWords(const CPVT_WordPlace & place) | 1426 void CPDF_VariableText::ClearSectionRightWords(const CPVT_WordPlace & place) |
1427 { | 1427 { |
1428 CPVT_WordPlace wordplace = AjustLineHeader(place, TRUE); | 1428 CPVT_WordPlace wordplace = AjustLineHeader(place, true); |
1429 if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) { | 1429 if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) { |
1430 for (int32_t w = pSection->m_WordArray.GetSize() - 1; w > wordplace.nWor
dIndex; w--) { | 1430 for (int32_t w = pSection->m_WordArray.GetSize() - 1; w > wordplace.nWor
dIndex; w--) { |
1431 delete pSection->m_WordArray.GetAt(w); | 1431 delete pSection->m_WordArray.GetAt(w); |
1432 pSection->m_WordArray.RemoveAt(w); | 1432 pSection->m_WordArray.RemoveAt(w); |
1433 } | 1433 } |
1434 } | 1434 } |
1435 } | 1435 } |
1436 CPVT_WordPlace CPDF_VariableText::AjustLineHeader(const CPVT_WordPlace & place,
FX_BOOL bPrevOrNext) const | 1436 CPVT_WordPlace CPDF_VariableText::AjustLineHeader(const CPVT_WordPlace & place,
bool bPrevOrNext) const |
1437 { | 1437 { |
1438 if (place.nWordIndex < 0 && place.nLineIndex > 0) { | 1438 if (place.nWordIndex < 0 && place.nLineIndex > 0) { |
1439 if (bPrevOrNext) { | 1439 if (bPrevOrNext) { |
1440 return GetPrevWordPlace(place); | 1440 return GetPrevWordPlace(place); |
1441 } else { | 1441 } else { |
1442 return GetNextWordPlace(place); | 1442 return GetNextWordPlace(place); |
1443 } | 1443 } |
1444 } | 1444 } |
1445 return place; | 1445 return place; |
1446 } | 1446 } |
1447 FX_BOOL CPDF_VariableText::ClearEmptySection(const CPVT_WordPlace & place) | 1447 bool CPDF_VariableText::ClearEmptySection(const CPVT_WordPlace & place) |
1448 { | 1448 { |
1449 if (place.nSecIndex == 0 && m_SectionArray.GetSize() == 1) { | 1449 if (place.nSecIndex == 0 && m_SectionArray.GetSize() == 1) { |
1450 return FALSE; | 1450 return false; |
1451 } | 1451 } |
1452 if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) { | 1452 if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) { |
1453 if (pSection->m_WordArray.GetSize() == 0) { | 1453 if (pSection->m_WordArray.GetSize() == 0) { |
1454 delete pSection; | 1454 delete pSection; |
1455 m_SectionArray.RemoveAt(place.nSecIndex); | 1455 m_SectionArray.RemoveAt(place.nSecIndex); |
1456 return TRUE; | 1456 return true; |
1457 } | 1457 } |
1458 } | 1458 } |
1459 return FALSE; | 1459 return false; |
1460 } | 1460 } |
1461 void CPDF_VariableText::ClearEmptySections(const CPVT_WordRange & PlaceRange) | 1461 void CPDF_VariableText::ClearEmptySections(const CPVT_WordRange & PlaceRange) |
1462 { | 1462 { |
1463 CPVT_WordPlace wordplace; | 1463 CPVT_WordPlace wordplace; |
1464 for (int32_t s = PlaceRange.EndPos.nSecIndex; s > PlaceRange.BeginPos.nSecIn
dex; s--) { | 1464 for (int32_t s = PlaceRange.EndPos.nSecIndex; s > PlaceRange.BeginPos.nSecIn
dex; s--) { |
1465 wordplace.nSecIndex = s; | 1465 wordplace.nSecIndex = s; |
1466 ClearEmptySection(wordplace); | 1466 ClearEmptySection(wordplace); |
1467 } | 1467 } |
1468 } | 1468 } |
1469 void CPDF_VariableText::LinkLatterSection(const CPVT_WordPlace & place) | 1469 void CPDF_VariableText::LinkLatterSection(const CPVT_WordPlace & place) |
1470 { | 1470 { |
1471 CPVT_WordPlace oldplace = AjustLineHeader(place, TRUE); | 1471 CPVT_WordPlace oldplace = AjustLineHeader(place, true); |
1472 if (CSection * pNextSection = m_SectionArray.GetAt(place.nSecIndex + 1)) { | 1472 if (CSection * pNextSection = m_SectionArray.GetAt(place.nSecIndex + 1)) { |
1473 if (CSection * pSection = m_SectionArray.GetAt(oldplace.nSecIndex)) { | 1473 if (CSection * pSection = m_SectionArray.GetAt(oldplace.nSecIndex)) { |
1474 for (int32_t w = 0, sz = pNextSection->m_WordArray.GetSize(); w < sz
; w++) { | 1474 for (int32_t w = 0, sz = pNextSection->m_WordArray.GetSize(); w < sz
; w++) { |
1475 if (CPVT_WordInfo * pWord = pNextSection->m_WordArray.GetAt(w))
{ | 1475 if (CPVT_WordInfo * pWord = pNextSection->m_WordArray.GetAt(w))
{ |
1476 oldplace.nWordIndex ++; | 1476 oldplace.nWordIndex ++; |
1477 pSection->AddWord(oldplace, *pWord); | 1477 pSection->AddWord(oldplace, *pWord); |
1478 } | 1478 } |
1479 } | 1479 } |
1480 } | 1480 } |
1481 delete pNextSection; | 1481 delete pNextSection; |
1482 m_SectionArray.RemoveAt(place.nSecIndex + 1); | 1482 m_SectionArray.RemoveAt(place.nSecIndex + 1); |
1483 } | 1483 } |
1484 } | 1484 } |
1485 void CPDF_VariableText::ClearWords(const CPVT_WordRange & PlaceRange) | 1485 void CPDF_VariableText::ClearWords(const CPVT_WordRange & PlaceRange) |
1486 { | 1486 { |
1487 CPVT_WordRange NewRange; | 1487 CPVT_WordRange NewRange; |
1488 NewRange.BeginPos = AjustLineHeader(PlaceRange.BeginPos, TRUE); | 1488 NewRange.BeginPos = AjustLineHeader(PlaceRange.BeginPos, true); |
1489 NewRange.EndPos = AjustLineHeader(PlaceRange.EndPos, TRUE); | 1489 NewRange.EndPos = AjustLineHeader(PlaceRange.EndPos, true); |
1490 for (int32_t s = NewRange.EndPos.nSecIndex; s >= NewRange.BeginPos.nSecIndex
; s--) { | 1490 for (int32_t s = NewRange.EndPos.nSecIndex; s >= NewRange.BeginPos.nSecIndex
; s--) { |
1491 if (CSection * pSection = m_SectionArray.GetAt(s)) { | 1491 if (CSection * pSection = m_SectionArray.GetAt(s)) { |
1492 pSection->ClearWords(NewRange); | 1492 pSection->ClearWords(NewRange); |
1493 } | 1493 } |
1494 } | 1494 } |
1495 } | 1495 } |
1496 CPVT_WordPlace CPDF_VariableText::ClearLeftWord(const CPVT_WordPlace & place) | 1496 CPVT_WordPlace CPDF_VariableText::ClearLeftWord(const CPVT_WordPlace & place) |
1497 { | 1497 { |
1498 if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) { | 1498 if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) { |
1499 CPVT_WordPlace leftplace = GetPrevWordPlace(place); | 1499 CPVT_WordPlace leftplace = GetPrevWordPlace(place); |
1500 if (leftplace != place) { | 1500 if (leftplace != place) { |
1501 if (leftplace.nSecIndex != place.nSecIndex) { | 1501 if (leftplace.nSecIndex != place.nSecIndex) { |
1502 if (pSection->m_WordArray.GetSize() == 0) { | 1502 if (pSection->m_WordArray.GetSize() == 0) { |
1503 ClearEmptySection(place); | 1503 ClearEmptySection(place); |
1504 } else { | 1504 } else { |
1505 LinkLatterSection(leftplace); | 1505 LinkLatterSection(leftplace); |
1506 } | 1506 } |
1507 } else { | 1507 } else { |
1508 pSection->ClearWord(place); | 1508 pSection->ClearWord(place); |
1509 } | 1509 } |
1510 } | 1510 } |
1511 return leftplace; | 1511 return leftplace; |
1512 } | 1512 } |
1513 return place; | 1513 return place; |
1514 } | 1514 } |
1515 CPVT_WordPlace CPDF_VariableText::ClearRightWord(const CPVT_WordPlace & place) | 1515 CPVT_WordPlace CPDF_VariableText::ClearRightWord(const CPVT_WordPlace & place) |
1516 { | 1516 { |
1517 if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) { | 1517 if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) { |
1518 CPVT_WordPlace rightplace = AjustLineHeader(GetNextWordPlace(place), FAL
SE); | 1518 CPVT_WordPlace rightplace = AjustLineHeader(GetNextWordPlace(place), fal
se); |
1519 if (rightplace != place) { | 1519 if (rightplace != place) { |
1520 if(rightplace.nSecIndex != place.nSecIndex) { | 1520 if(rightplace.nSecIndex != place.nSecIndex) { |
1521 LinkLatterSection(place); | 1521 LinkLatterSection(place); |
1522 } else { | 1522 } else { |
1523 pSection->ClearWord(rightplace); | 1523 pSection->ClearWord(rightplace); |
1524 } | 1524 } |
1525 } | 1525 } |
1526 } | 1526 } |
1527 return place; | 1527 return place; |
1528 } | 1528 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1569 nMid = (nLeft + nRight) / 2; | 1569 nMid = (nLeft + nRight) / 2; |
1570 continue; | 1570 continue; |
1571 } else { | 1571 } else { |
1572 nLeft = nMid + 1; | 1572 nLeft = nMid + 1; |
1573 nMid = (nLeft + nRight) / 2; | 1573 nMid = (nLeft + nRight) / 2; |
1574 continue; | 1574 continue; |
1575 } | 1575 } |
1576 } | 1576 } |
1577 return (FX_FLOAT)gFontSizeSteps[nMid]; | 1577 return (FX_FLOAT)gFontSizeSteps[nMid]; |
1578 } | 1578 } |
1579 FX_BOOL»CPDF_VariableText::IsBigger(FX_FLOAT fFontSize) | 1579 bool» CPDF_VariableText::IsBigger(FX_FLOAT fFontSize) |
1580 { | 1580 { |
1581 FX_BOOL bBigger = FALSE; | 1581 bool bBigger = false; |
1582 CPVT_Size szTotal; | 1582 CPVT_Size szTotal; |
1583 for (int32_t s = 0, sz = m_SectionArray.GetSize(); s < sz; s++) { | 1583 for (int32_t s = 0, sz = m_SectionArray.GetSize(); s < sz; s++) { |
1584 if (CSection * pSection = m_SectionArray.GetAt(s)) { | 1584 if (CSection * pSection = m_SectionArray.GetAt(s)) { |
1585 CPVT_Size size = pSection->GetSectionSize(fFontSize); | 1585 CPVT_Size size = pSection->GetSectionSize(fFontSize); |
1586 szTotal.x = FPDF_MAX(size.x, szTotal.x); | 1586 szTotal.x = FPDF_MAX(size.x, szTotal.x); |
1587 szTotal.y += size.y; | 1587 szTotal.y += size.y; |
1588 if (IsFloatBigger(szTotal.x, GetPlateWidth()) | 1588 if (IsFloatBigger(szTotal.x, GetPlateWidth()) |
1589 || IsFloatBigger(szTotal.y, GetPlateHeight()) | 1589 || IsFloatBigger(szTotal.y, GetPlateHeight()) |
1590 ) { | 1590 ) { |
1591 bBigger = TRUE; | 1591 bBigger = true; |
1592 break; | 1592 break; |
1593 } | 1593 } |
1594 } | 1594 } |
1595 } | 1595 } |
1596 return bBigger; | 1596 return bBigger; |
1597 } | 1597 } |
1598 CPVT_FloatRect CPDF_VariableText::RearrangeSections(const CPVT_WordRange & Place
Range) | 1598 CPVT_FloatRect CPDF_VariableText::RearrangeSections(const CPVT_WordRange & Place
Range) |
1599 { | 1599 { |
1600 CPVT_WordPlace place; | 1600 CPVT_WordPlace place; |
1601 FX_FLOAT fPosY = 0; | 1601 FX_FLOAT fPosY = 0; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1654 return m_pVTProvider ? m_pVTProvider->GetTypeDescent(nFontIndex) : 0; | 1654 return m_pVTProvider ? m_pVTProvider->GetTypeDescent(nFontIndex) : 0; |
1655 } | 1655 } |
1656 int32_t CPDF_VariableText::GetWordFontIndex(FX_WORD word, int32_t charset, int32
_t nFontIndex) | 1656 int32_t CPDF_VariableText::GetWordFontIndex(FX_WORD word, int32_t charset, int32
_t nFontIndex) |
1657 { | 1657 { |
1658 return m_pVTProvider ? m_pVTProvider->GetWordFontIndex(word, charset, nFontI
ndex) : -1; | 1658 return m_pVTProvider ? m_pVTProvider->GetWordFontIndex(word, charset, nFontI
ndex) : -1; |
1659 } | 1659 } |
1660 int32_t CPDF_VariableText::GetDefaultFontIndex() | 1660 int32_t CPDF_VariableText::GetDefaultFontIndex() |
1661 { | 1661 { |
1662 return m_pVTProvider ? m_pVTProvider->GetDefaultFontIndex() : -1; | 1662 return m_pVTProvider ? m_pVTProvider->GetDefaultFontIndex() : -1; |
1663 } | 1663 } |
1664 FX_BOOL»CPDF_VariableText::IsLatinWord(FX_WORD word) | 1664 bool» CPDF_VariableText::IsLatinWord(FX_WORD word) |
1665 { | 1665 { |
1666 return m_pVTProvider ? m_pVTProvider->IsLatinWord(word) : FALSE; | 1666 return m_pVTProvider ? m_pVTProvider->IsLatinWord(word) : false; |
1667 } | 1667 } |
1668 IPDF_VariableText_Iterator * CPDF_VariableText::GetIterator() | 1668 IPDF_VariableText_Iterator * CPDF_VariableText::GetIterator() |
1669 { | 1669 { |
1670 if (!m_pVTIterator) { | 1670 if (!m_pVTIterator) { |
1671 m_pVTIterator = new CPDF_VariableText_Iterator(this); | 1671 m_pVTIterator = new CPDF_VariableText_Iterator(this); |
1672 } | 1672 } |
1673 return m_pVTIterator; | 1673 return m_pVTIterator; |
1674 } | 1674 } |
1675 IPDF_VariableText_Provider* CPDF_VariableText::SetProvider(IPDF_VariableText
_Provider * pProvider) | 1675 IPDF_VariableText_Provider* CPDF_VariableText::SetProvider(IPDF_VariableText
_Provider * pProvider) |
1676 { | 1676 { |
(...skipping 12 matching lines...) Expand all Loading... |
1689 void CPDF_VariableText_Iterator::SetAt(int32_t nWordIndex) | 1689 void CPDF_VariableText_Iterator::SetAt(int32_t nWordIndex) |
1690 { | 1690 { |
1691 ASSERT(m_pVT != NULL); | 1691 ASSERT(m_pVT != NULL); |
1692 m_CurPos = m_pVT->WordIndexToWordPlace(nWordIndex); | 1692 m_CurPos = m_pVT->WordIndexToWordPlace(nWordIndex); |
1693 } | 1693 } |
1694 void CPDF_VariableText_Iterator::SetAt(const CPVT_WordPlace & place) | 1694 void CPDF_VariableText_Iterator::SetAt(const CPVT_WordPlace & place) |
1695 { | 1695 { |
1696 ASSERT(m_pVT != NULL); | 1696 ASSERT(m_pVT != NULL); |
1697 m_CurPos = place; | 1697 m_CurPos = place; |
1698 } | 1698 } |
1699 FX_BOOL»CPDF_VariableText_Iterator::NextWord() | 1699 bool» CPDF_VariableText_Iterator::NextWord() |
1700 { | 1700 { |
1701 ASSERT(m_pVT != NULL); | 1701 ASSERT(m_pVT != NULL); |
1702 if (m_CurPos == m_pVT->GetEndWordPlace()) { | 1702 if (m_CurPos == m_pVT->GetEndWordPlace()) { |
1703 return FALSE; | 1703 return false; |
1704 } | 1704 } |
1705 m_CurPos = m_pVT->GetNextWordPlace(m_CurPos); | 1705 m_CurPos = m_pVT->GetNextWordPlace(m_CurPos); |
1706 return TRUE; | 1706 return true; |
1707 } | 1707 } |
1708 FX_BOOL»CPDF_VariableText_Iterator::PrevWord() | 1708 bool» CPDF_VariableText_Iterator::PrevWord() |
1709 { | 1709 { |
1710 ASSERT(m_pVT != NULL); | 1710 ASSERT(m_pVT != NULL); |
1711 if (m_CurPos == m_pVT->GetBeginWordPlace()) { | 1711 if (m_CurPos == m_pVT->GetBeginWordPlace()) { |
1712 return FALSE; | 1712 return false; |
1713 } | 1713 } |
1714 m_CurPos = m_pVT->GetPrevWordPlace(m_CurPos); | 1714 m_CurPos = m_pVT->GetPrevWordPlace(m_CurPos); |
1715 return TRUE; | 1715 return true; |
1716 } | 1716 } |
1717 FX_BOOL»CPDF_VariableText_Iterator::NextLine() | 1717 bool» CPDF_VariableText_Iterator::NextLine() |
1718 { | 1718 { |
1719 ASSERT(m_pVT != NULL); | 1719 ASSERT(m_pVT != NULL); |
1720 if (CSection * pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { | 1720 if (CSection * pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { |
1721 if (m_CurPos.nLineIndex < pSection->m_LineArray.GetSize() - 1) { | 1721 if (m_CurPos.nLineIndex < pSection->m_LineArray.GetSize() - 1) { |
1722 m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex +
1, -1); | 1722 m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex +
1, -1); |
1723 return TRUE; | 1723 return true; |
1724 } else { | 1724 } else { |
1725 if (m_CurPos.nSecIndex < m_pVT->m_SectionArray.GetSize() - 1) { | 1725 if (m_CurPos.nSecIndex < m_pVT->m_SectionArray.GetSize() - 1) { |
1726 m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex + 1, 0, -1); | 1726 m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex + 1, 0, -1); |
1727 return TRUE; | 1727 return true; |
1728 } | 1728 } |
1729 } | 1729 } |
1730 } | 1730 } |
1731 return FALSE; | 1731 return false; |
1732 } | 1732 } |
1733 FX_BOOL»CPDF_VariableText_Iterator::PrevLine() | 1733 bool» CPDF_VariableText_Iterator::PrevLine() |
1734 { | 1734 { |
1735 ASSERT(m_pVT != NULL); | 1735 ASSERT(m_pVT != NULL); |
1736 if (m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { | 1736 if (m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { |
1737 if (m_CurPos.nLineIndex > 0) { | 1737 if (m_CurPos.nLineIndex > 0) { |
1738 m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex -
1, -1); | 1738 m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex -
1, -1); |
1739 return TRUE; | 1739 return true; |
1740 } else { | 1740 } else { |
1741 if (m_CurPos.nSecIndex > 0) { | 1741 if (m_CurPos.nSecIndex > 0) { |
1742 if (CSection * pLastSection = m_pVT->m_SectionArray.GetAt(m_CurP
os.nSecIndex - 1)) { | 1742 if (CSection * pLastSection = m_pVT->m_SectionArray.GetAt(m_CurP
os.nSecIndex - 1)) { |
1743 m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex - 1, pLastSecti
on->m_LineArray.GetSize() - 1, -1); | 1743 m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex - 1, pLastSecti
on->m_LineArray.GetSize() - 1, -1); |
1744 return TRUE; | 1744 return true; |
1745 } | 1745 } |
1746 } | 1746 } |
1747 } | 1747 } |
1748 } | 1748 } |
1749 return FALSE; | 1749 return false; |
1750 } | 1750 } |
1751 FX_BOOL»CPDF_VariableText_Iterator::NextSection() | 1751 bool» CPDF_VariableText_Iterator::NextSection() |
1752 { | 1752 { |
1753 ASSERT(m_pVT != NULL); | 1753 ASSERT(m_pVT != NULL); |
1754 if (m_CurPos.nSecIndex < m_pVT->m_SectionArray.GetSize() - 1) { | 1754 if (m_CurPos.nSecIndex < m_pVT->m_SectionArray.GetSize() - 1) { |
1755 m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex + 1, 0, -1); | 1755 m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex + 1, 0, -1); |
1756 return TRUE; | 1756 return true; |
1757 } | 1757 } |
1758 return FALSE; | 1758 return false; |
1759 } | 1759 } |
1760 FX_BOOL»CPDF_VariableText_Iterator::PrevSection() | 1760 bool» CPDF_VariableText_Iterator::PrevSection() |
1761 { | 1761 { |
1762 ASSERT(m_pVT != NULL); | 1762 ASSERT(m_pVT != NULL); |
1763 if (m_CurPos.nSecIndex > 0) { | 1763 if (m_CurPos.nSecIndex > 0) { |
1764 m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex - 1, 0, -1); | 1764 m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex - 1, 0, -1); |
1765 return TRUE; | 1765 return true; |
1766 } | 1766 } |
1767 return FALSE; | 1767 return false; |
1768 } | 1768 } |
1769 FX_BOOL»CPDF_VariableText_Iterator::GetWord(CPVT_Word & word) const | 1769 bool» CPDF_VariableText_Iterator::GetWord(CPVT_Word & word) const |
1770 { | 1770 { |
1771 ASSERT(m_pVT != NULL); | 1771 ASSERT(m_pVT != NULL); |
1772 word.WordPlace = m_CurPos; | 1772 word.WordPlace = m_CurPos; |
1773 if (CSection * pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { | 1773 if (CSection * pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { |
1774 if (pSection->m_LineArray.GetAt(m_CurPos.nLineIndex)) { | 1774 if (pSection->m_LineArray.GetAt(m_CurPos.nLineIndex)) { |
1775 if (CPVT_WordInfo * pWord = pSection->m_WordArray.GetAt(m_CurPos.nWo
rdIndex)) { | 1775 if (CPVT_WordInfo * pWord = pSection->m_WordArray.GetAt(m_CurPos.nWo
rdIndex)) { |
1776 word.Word = pWord->Word; | 1776 word.Word = pWord->Word; |
1777 word.nCharset = pWord->nCharset; | 1777 word.nCharset = pWord->nCharset; |
1778 word.fWidth = m_pVT->GetWordWidth(*pWord); | 1778 word.fWidth = m_pVT->GetWordWidth(*pWord); |
1779 word.ptWord = m_pVT->InToOut( | 1779 word.ptWord = m_pVT->InToOut( |
1780 CPDF_Point(pWord->fWordX + pSection->m_SecInfo
.rcSection.left, | 1780 CPDF_Point(pWord->fWordX + pSection->m_SecInfo
.rcSection.left, |
1781 pWord->fWordY + pSection->m_SecInfo
.rcSection.top) ); | 1781 pWord->fWordY + pSection->m_SecInfo
.rcSection.top) ); |
1782 word.fAscent = m_pVT->GetWordAscent(*pWord); | 1782 word.fAscent = m_pVT->GetWordAscent(*pWord); |
1783 word.fDescent = m_pVT->GetWordDescent(*pWord); | 1783 word.fDescent = m_pVT->GetWordDescent(*pWord); |
1784 if (pWord->pWordProps) { | 1784 if (pWord->pWordProps) { |
1785 word.WordProps = *pWord->pWordProps; | 1785 word.WordProps = *pWord->pWordProps; |
1786 } | 1786 } |
1787 word.nFontIndex = m_pVT->GetWordFontIndex(*pWord); | 1787 word.nFontIndex = m_pVT->GetWordFontIndex(*pWord); |
1788 word.fFontSize = m_pVT->GetWordFontSize(*pWord); | 1788 word.fFontSize = m_pVT->GetWordFontSize(*pWord); |
1789 return TRUE; | 1789 return true; |
1790 } | 1790 } |
1791 } | 1791 } |
1792 } | 1792 } |
1793 return FALSE; | 1793 return false; |
1794 } | 1794 } |
1795 FX_BOOL»CPDF_VariableText_Iterator::SetWord(const CPVT_Word & word) | 1795 bool» CPDF_VariableText_Iterator::SetWord(const CPVT_Word & word) |
1796 { | 1796 { |
1797 ASSERT(m_pVT != NULL); | 1797 ASSERT(m_pVT != NULL); |
1798 if (CSection * pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { | 1798 if (CSection * pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { |
1799 if (CPVT_WordInfo * pWord = pSection->m_WordArray.GetAt(m_CurPos.nWordIn
dex)) { | 1799 if (CPVT_WordInfo * pWord = pSection->m_WordArray.GetAt(m_CurPos.nWordIn
dex)) { |
1800 if (pWord->pWordProps) { | 1800 if (pWord->pWordProps) { |
1801 *pWord->pWordProps = word.WordProps; | 1801 *pWord->pWordProps = word.WordProps; |
1802 } | 1802 } |
1803 return TRUE; | 1803 return true; |
1804 } | 1804 } |
1805 } | 1805 } |
1806 return FALSE; | 1806 return false; |
1807 } | 1807 } |
1808 FX_BOOL»CPDF_VariableText_Iterator::GetLine(CPVT_Line & line) const | 1808 bool» CPDF_VariableText_Iterator::GetLine(CPVT_Line & line) const |
1809 { | 1809 { |
1810 ASSERT(m_pVT != NULL); | 1810 ASSERT(m_pVT != NULL); |
1811 line.lineplace = CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex, -1)
; | 1811 line.lineplace = CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex, -1)
; |
1812 if (CSection * pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { | 1812 if (CSection * pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { |
1813 if (CLine * pLine = pSection->m_LineArray.GetAt(m_CurPos.nLineIndex)) { | 1813 if (CLine * pLine = pSection->m_LineArray.GetAt(m_CurPos.nLineIndex)) { |
1814 line.ptLine = m_pVT->InToOut( | 1814 line.ptLine = m_pVT->InToOut( |
1815 CPDF_Point(pLine->m_LineInfo.fLineX + pSection->m_
SecInfo.rcSection.left, | 1815 CPDF_Point(pLine->m_LineInfo.fLineX + pSection->m_
SecInfo.rcSection.left, |
1816 pLine->m_LineInfo.fLineY + pSection->m_
SecInfo.rcSection.top) ); | 1816 pLine->m_LineInfo.fLineY + pSection->m_
SecInfo.rcSection.top) ); |
1817 line.fLineWidth = pLine->m_LineInfo.fLineWidth; | 1817 line.fLineWidth = pLine->m_LineInfo.fLineWidth; |
1818 line.fLineAscent = pLine->m_LineInfo.fLineAscent; | 1818 line.fLineAscent = pLine->m_LineInfo.fLineAscent; |
1819 line.fLineDescent = pLine->m_LineInfo.fLineDescent; | 1819 line.fLineDescent = pLine->m_LineInfo.fLineDescent; |
1820 line.lineEnd = pLine->GetEndWordPlace(); | 1820 line.lineEnd = pLine->GetEndWordPlace(); |
1821 return TRUE; | 1821 return true; |
1822 } | 1822 } |
1823 } | 1823 } |
1824 return FALSE; | 1824 return false; |
1825 } | 1825 } |
1826 FX_BOOL»CPDF_VariableText_Iterator::GetSection(CPVT_Section & section) const | 1826 bool» CPDF_VariableText_Iterator::GetSection(CPVT_Section & section) const |
1827 { | 1827 { |
1828 ASSERT(m_pVT != NULL); | 1828 ASSERT(m_pVT != NULL); |
1829 section.secplace = CPVT_WordPlace(m_CurPos.nSecIndex, 0, -1); | 1829 section.secplace = CPVT_WordPlace(m_CurPos.nSecIndex, 0, -1); |
1830 if (CSection * pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { | 1830 if (CSection * pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { |
1831 section.rcSection = m_pVT->InToOut(pSection->m_SecInfo.rcSection); | 1831 section.rcSection = m_pVT->InToOut(pSection->m_SecInfo.rcSection); |
1832 if (pSection->m_SecInfo.pSecProps) { | 1832 if (pSection->m_SecInfo.pSecProps) { |
1833 section.SecProps = *pSection->m_SecInfo.pSecProps; | 1833 section.SecProps = *pSection->m_SecInfo.pSecProps; |
1834 } | 1834 } |
1835 if (pSection->m_SecInfo.pWordProps) { | 1835 if (pSection->m_SecInfo.pWordProps) { |
1836 section.WordProps = *pSection->m_SecInfo.pWordProps; | 1836 section.WordProps = *pSection->m_SecInfo.pWordProps; |
1837 } | 1837 } |
1838 return TRUE; | 1838 return true; |
1839 } | 1839 } |
1840 return FALSE; | 1840 return false; |
1841 } | 1841 } |
1842 FX_BOOL»CPDF_VariableText_Iterator::SetSection(const CPVT_Section & section) | 1842 bool» CPDF_VariableText_Iterator::SetSection(const CPVT_Section & section) |
1843 { | 1843 { |
1844 ASSERT(m_pVT != NULL); | 1844 ASSERT(m_pVT != NULL); |
1845 if (CSection * pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { | 1845 if (CSection * pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { |
1846 if (pSection->m_SecInfo.pSecProps) { | 1846 if (pSection->m_SecInfo.pSecProps) { |
1847 *pSection->m_SecInfo.pSecProps = section.SecProps; | 1847 *pSection->m_SecInfo.pSecProps = section.SecProps; |
1848 } | 1848 } |
1849 if (pSection->m_SecInfo.pWordProps) { | 1849 if (pSection->m_SecInfo.pWordProps) { |
1850 *pSection->m_SecInfo.pWordProps = section.WordProps; | 1850 *pSection->m_SecInfo.pWordProps = section.WordProps; |
1851 } | 1851 } |
1852 return TRUE; | 1852 return true; |
1853 } | 1853 } |
1854 return FALSE; | 1854 return false; |
1855 } | 1855 } |
OLD | NEW |