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/pdfwindow/PDFWindow.h" | 7 #include "../../include/pdfwindow/PDFWindow.h" |
8 #include "../../include/pdfwindow/PWL_Wnd.h" | 8 #include "../../include/pdfwindow/PWL_Wnd.h" |
9 #include "../../include/pdfwindow/PWL_Utils.h" | 9 #include "../../include/pdfwindow/PWL_Utils.h" |
10 #include "../../include/pdfwindow/PWL_Icon.h" | 10 #include "../../include/pdfwindow/PWL_Icon.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 80 |
81 return rcRet; | 81 return rcRet; |
82 } | 82 } |
83 | 83 |
84 CPDF_Rect CPWL_Utils::OffsetRect(const CPDF_Rect & rect,FX_FLOAT x,FX_FLOAT y) | 84 CPDF_Rect CPWL_Utils::OffsetRect(const CPDF_Rect & rect,FX_FLOAT x,FX_FLOAT y) |
85 { | 85 { |
86 return CPDF_Rect(rect.left + x,rect.bottom + y, | 86 return CPDF_Rect(rect.left + x,rect.bottom + y, |
87 rect.right + x,rect.top + y); | 87 rect.right + x,rect.top + y); |
88 } | 88 } |
89 | 89 |
90 FX_BOOL CPWL_Utils::ContainsRect(const CPDF_Rect& rcParent, const CPDF_Rect& rcC
hild) | 90 bool CPWL_Utils::ContainsRect(const CPDF_Rect& rcParent, const CPDF_Rect& rcChil
d) |
91 { | 91 { |
92 return rcChild.left >= rcParent.left && rcChild.bottom >= rcParent.botto
m && | 92 return rcChild.left >= rcParent.left && rcChild.bottom >= rcParent.botto
m && |
93 rcChild.right <= rcParent.right && rcChild.top <= rcPare
nt.top; | 93 rcChild.right <= rcParent.right && rcChild.top <= rcPare
nt.top; |
94 } | 94 } |
95 | 95 |
96 FX_BOOL CPWL_Utils::IntersectRect(const CPDF_Rect& rect1, const CPDF_Rect& rect2
) | 96 bool CPWL_Utils::IntersectRect(const CPDF_Rect& rect1, const CPDF_Rect& rect2) |
97 { | 97 { |
98 FX_FLOAT left = rect1.left > rect2.left ? rect1.left : rect2.left; | 98 FX_FLOAT left = rect1.left > rect2.left ? rect1.left : rect2.left; |
99 FX_FLOAT right = rect1.right < rect2.right ? rect1.right : rect2.right; | 99 FX_FLOAT right = rect1.right < rect2.right ? rect1.right : rect2.right; |
100 FX_FLOAT bottom = rect1.bottom > rect2.bottom ? rect1.bottom : rect2.bot
tom; | 100 FX_FLOAT bottom = rect1.bottom > rect2.bottom ? rect1.bottom : rect2.bot
tom; |
101 FX_FLOAT top = rect1.top < rect2.top ? rect1.top : rect2.top; | 101 FX_FLOAT top = rect1.top < rect2.top ? rect1.top : rect2.top; |
102 | 102 |
103 return left < right && bottom < top; | 103 return left < right && bottom < top; |
104 } | 104 } |
105 | 105 |
106 CPDF_Point CPWL_Utils::OffsetPoint(const CPDF_Point& point,FX_FLOAT x,FX_FLOAT y
) | 106 CPDF_Point CPWL_Utils::OffsetPoint(const CPDF_Point& point,FX_FLOAT x,FX_FLOAT y
) |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 return CPDF_Rect(ptCenter.x - fHalfWidth * fScale, | 413 return CPDF_Rect(ptCenter.x - fHalfWidth * fScale, |
414 ptCenter.y - fHalfHeight * fScale, | 414 ptCenter.y - fHalfHeight * fScale, |
415 ptCenter.x + fHalfWidth * fScale, | 415 ptCenter.x + fHalfWidth * fScale, |
416 ptCenter.y + fHalfHeight * fScale); | 416 ptCenter.y + fHalfHeight * fScale); |
417 } | 417 } |
418 | 418 |
419 CFX_ByteString CPWL_Utils::GetRectFillAppStream(const CPDF_Rect & rect,const CPW
L_Color & color) | 419 CFX_ByteString CPWL_Utils::GetRectFillAppStream(const CPDF_Rect & rect,const CPW
L_Color & color) |
420 { | 420 { |
421 CFX_ByteTextBuf sAppStream; | 421 CFX_ByteTextBuf sAppStream; |
422 | 422 |
423 » CFX_ByteString sColor = GetColorAppStream(color,TRUE); | 423 » CFX_ByteString sColor = GetColorAppStream(color,true); |
424 if (sColor.GetLength() > 0) | 424 if (sColor.GetLength() > 0) |
425 { | 425 { |
426 sAppStream << "q\n" << sColor; | 426 sAppStream << "q\n" << sColor; |
427 sAppStream << rect.left << " " << rect.bottom << " " | 427 sAppStream << rect.left << " " << rect.bottom << " " |
428 << rect.right - rect.left << " " << rect.top - rect.bott
om << " re f\nQ\n"; | 428 << rect.right - rect.left << " " << rect.top - rect.bott
om << " re f\nQ\n"; |
429 } | 429 } |
430 | 430 |
431 return sAppStream.GetByteString(); | 431 return sAppStream.GetByteString(); |
432 } | 432 } |
433 | 433 |
434 CFX_ByteString CPWL_Utils::GetCircleFillAppStream(const CPDF_Rect & rect,const C
PWL_Color & color) | 434 CFX_ByteString CPWL_Utils::GetCircleFillAppStream(const CPDF_Rect & rect,const C
PWL_Color & color) |
435 { | 435 { |
436 CFX_ByteTextBuf sAppStream; | 436 CFX_ByteTextBuf sAppStream; |
437 | 437 |
438 » CFX_ByteString sColor = GetColorAppStream(color,TRUE); | 438 » CFX_ByteString sColor = GetColorAppStream(color,true); |
439 if (sColor.GetLength() > 0) | 439 if (sColor.GetLength() > 0) |
440 { | 440 { |
441 sAppStream << "q\n" << sColor << CPWL_Utils::GetAP_Circle(rect)
<< "f\nQ\n"; | 441 sAppStream << "q\n" << sColor << CPWL_Utils::GetAP_Circle(rect)
<< "f\nQ\n"; |
442 } | 442 } |
443 | 443 |
444 return sAppStream.GetByteString(); | 444 return sAppStream.GetByteString(); |
445 } | 445 } |
446 | 446 |
447 CPDF_Rect CPWL_Utils::GetCenterSquare(const CPDF_Rect & rect) | 447 CPDF_Rect CPWL_Utils::GetCenterSquare(const CPDF_Rect & rect) |
448 { | 448 { |
449 FX_FLOAT fWidth = rect.right - rect.left; | 449 FX_FLOAT fWidth = rect.right - rect.left; |
450 FX_FLOAT fHeight = rect.top - rect.bottom; | 450 FX_FLOAT fHeight = rect.top - rect.bottom; |
451 | 451 |
452 FX_FLOAT fCenterX = (rect.left + rect.right)/2.0f; | 452 FX_FLOAT fCenterX = (rect.left + rect.right)/2.0f; |
453 FX_FLOAT fCenterY = (rect.top + rect.bottom)/2.0f; | 453 FX_FLOAT fCenterY = (rect.top + rect.bottom)/2.0f; |
454 | 454 |
455 FX_FLOAT fRadius = (fWidth > fHeight) ? fHeight / 2 : fWidth / 2; | 455 FX_FLOAT fRadius = (fWidth > fHeight) ? fHeight / 2 : fWidth / 2; |
456 | 456 |
457 return CPDF_Rect(fCenterX - fRadius,fCenterY - fRadius,fCenterX + fRadiu
s,fCenterY + fRadius); | 457 return CPDF_Rect(fCenterX - fRadius,fCenterY - fRadius,fCenterX + fRadiu
s,fCenterY + fRadius); |
458 } | 458 } |
459 | 459 |
460 CFX_ByteString CPWL_Utils::GetEditAppStream(IFX_Edit* pEdit, const CPDF_Point &
ptOffset, const CPVT_WordRange * pRange, | 460 CFX_ByteString CPWL_Utils::GetEditAppStream(IFX_Edit* pEdit, const CPDF_Point &
ptOffset, const CPVT_WordRange * pRange, |
461 » » » » » » » » » »
» » » » FX_BOOL bContinuous, FX_WORD SubWord) | 461 » » » » » » » » » »
» » » » bool bContinuous, FX_WORD SubWord) |
462 { | 462 { |
463 return IFX_Edit::GetEditAppearanceStream(pEdit,ptOffset,pRange,bContinuo
us,SubWord); | 463 return IFX_Edit::GetEditAppearanceStream(pEdit,ptOffset,pRange,bContinuo
us,SubWord); |
464 } | 464 } |
465 | 465 |
466 CFX_ByteString CPWL_Utils::GetEditSelAppStream(IFX_Edit* pEdit, const CPDF_Point
& ptOffset, | 466 CFX_ByteString CPWL_Utils::GetEditSelAppStream(IFX_Edit* pEdit, const CPDF_Point
& ptOffset, |
467 const CPVT_WordR
ange * pRange) | 467 const CPVT_WordR
ange * pRange) |
468 { | 468 { |
469 return IFX_Edit::GetSelectAppearanceStream(pEdit,ptOffset,pRange); | 469 return IFX_Edit::GetSelectAppearanceStream(pEdit,ptOffset,pRange); |
470 } | 470 } |
471 | 471 |
(...skipping 19 matching lines...) Expand all Loading... |
491 static CFX_ByteString GetWordSpellCheckAppearanceStream(IFX_Edit_Iterator* pIter
ator, const CPDF_Point & ptOffset, | 491 static CFX_ByteString GetWordSpellCheckAppearanceStream(IFX_Edit_Iterator* pIter
ator, const CPDF_Point & ptOffset, |
492
const CPVT_WordRange & wrWord) | 492
const CPVT_WordRange & wrWord) |
493 { | 493 { |
494 CFX_ByteTextBuf sRet; | 494 CFX_ByteTextBuf sRet; |
495 | 495 |
496 FX_FLOAT fStartX = 0.0f; | 496 FX_FLOAT fStartX = 0.0f; |
497 FX_FLOAT fEndX = 0.0f; | 497 FX_FLOAT fEndX = 0.0f; |
498 FX_FLOAT fY = 0.0f; | 498 FX_FLOAT fY = 0.0f; |
499 FX_FLOAT fStep = 0.0f; | 499 FX_FLOAT fStep = 0.0f; |
500 | 500 |
501 » FX_BOOL bBreak = FALSE; | 501 » bool bBreak = false; |
502 | 502 |
503 if (pIterator) | 503 if (pIterator) |
504 { | 504 { |
505 pIterator->SetAt(wrWord.BeginPos); | 505 pIterator->SetAt(wrWord.BeginPos); |
506 | 506 |
507 do | 507 do |
508 { | 508 { |
509 CPVT_WordPlace place = pIterator->GetAt(); | 509 CPVT_WordPlace place = pIterator->GetAt(); |
510 | 510 |
511 CPVT_Line line; | 511 CPVT_Line line; |
(...skipping 19 matching lines...) Expand all Loading... |
531 | 531 |
532 if (place.LineCmp(wrWord.EndPos) == 0) | 532 if (place.LineCmp(wrWord.EndPos) == 0) |
533 { | 533 { |
534 pIterator->SetAt(wrWord.EndPos); | 534 pIterator->SetAt(wrWord.EndPos); |
535 CPVT_Word word; | 535 CPVT_Word word; |
536 if (pIterator->GetWord(word)) | 536 if (pIterator->GetWord(word)) |
537 { | 537 { |
538 fEndX = word.ptWord.x + word.fWidth; | 538 fEndX = word.ptWord.x + word.fWidth; |
539 } | 539 } |
540 | 540 |
541 » » » » bBreak = TRUE; | 541 » » » » bBreak = true; |
542 } | 542 } |
543 else | 543 else |
544 { | 544 { |
545 fEndX = line.ptLine.x + line.fLineWidth; | 545 fEndX = line.ptLine.x + line.fLineWidth; |
546 } | 546 } |
547 | 547 |
548 sRet << GetSquigglyAppearanceStream(fStartX + ptOffset.x
, fEndX + ptOffset.x, fY + ptOffset.y,fStep); | 548 sRet << GetSquigglyAppearanceStream(fStartX + ptOffset.x
, fEndX + ptOffset.x, fY + ptOffset.y,fStep); |
549 | 549 |
550 if (bBreak) break; | 550 if (bBreak) break; |
551 } | 551 } |
(...skipping 10 matching lines...) Expand all Loading... |
562 ASSERT(pSpellCheck != NULL); | 562 ASSERT(pSpellCheck != NULL); |
563 | 563 |
564 CFX_ByteTextBuf sRet; | 564 CFX_ByteTextBuf sRet; |
565 | 565 |
566 if (pRange && pRange->IsExist()) | 566 if (pRange && pRange->IsExist()) |
567 { | 567 { |
568 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) | 568 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) |
569 { | 569 { |
570 pIterator->SetAt(pRange->BeginPos); | 570 pIterator->SetAt(pRange->BeginPos); |
571 | 571 |
572 » » » FX_BOOL bLatinWord = FALSE; | 572 » » » bool bLatinWord = false; |
573 CPVT_WordPlace wpWordStart; | 573 CPVT_WordPlace wpWordStart; |
574 CFX_ByteString sWord; | 574 CFX_ByteString sWord; |
575 | 575 |
576 CPVT_WordPlace oldplace; | 576 CPVT_WordPlace oldplace; |
577 while (pIterator->NextWord()) | 577 while (pIterator->NextWord()) |
578 { | 578 { |
579 CPVT_WordPlace place = pIterator->GetAt(); | 579 CPVT_WordPlace place = pIterator->GetAt(); |
580 if (pRange && place.WordCmp(pRange->EndPos) > 0)
break; | 580 if (pRange && place.WordCmp(pRange->EndPos) > 0)
break; |
581 | 581 |
582 CPVT_Word word; | 582 CPVT_Word word; |
583 if (pIterator->GetWord(word)) | 583 if (pIterator->GetWord(word)) |
584 { | 584 { |
585 if (FX_EDIT_ISLATINWORD(word.Word)) | 585 if (FX_EDIT_ISLATINWORD(word.Word)) |
586 { | 586 { |
587 if (!bLatinWord) | 587 if (!bLatinWord) |
588 { | 588 { |
589 wpWordStart = place; | 589 wpWordStart = place; |
590 » » » » » » » bLatinWord = TRUE; | 590 » » » » » » » bLatinWord = true; |
591 } | 591 } |
592 | 592 |
593 sWord += (char)word.Word; | 593 sWord += (char)word.Word; |
594 oldplace = place; | 594 oldplace = place; |
595 } | 595 } |
596 else | 596 else |
597 { | 597 { |
598 if (bLatinWord) | 598 if (bLatinWord) |
599 { | 599 { |
600 if (!pSpellCheck->CheckW
ord(sWord)) | 600 if (!pSpellCheck->CheckW
ord(sWord)) |
601 { | 601 { |
602 sRet << GetWordS
pellCheckAppearanceStream(pIterator,ptOffset,CPVT_WordRange(wpWordStart,oldplace
)); | 602 sRet << GetWordS
pellCheckAppearanceStream(pIterator,ptOffset,CPVT_WordRange(wpWordStart,oldplace
)); |
603 pIterator->SetAt
(place); | 603 pIterator->SetAt
(place); |
604 } | 604 } |
605 » » » » » » » bLatinWord = FALSE; | 605 » » » » » » » bLatinWord = false; |
606 } | 606 } |
607 | 607 |
608 sWord.Empty(); | 608 sWord.Empty(); |
609 } | 609 } |
610 } | 610 } |
611 else | 611 else |
612 { | 612 { |
613 if (bLatinWord) | 613 if (bLatinWord) |
614 { | 614 { |
615 if (!pSpellCheck->CheckWord(sWor
d)) | 615 if (!pSpellCheck->CheckWord(sWor
d)) |
616 sRet << GetWordSpellChec
kAppearanceStream(pIterator,ptOffset,CPVT_WordRange(wpWordStart,oldplace)); | 616 sRet << GetWordSpellChec
kAppearanceStream(pIterator,ptOffset,CPVT_WordRange(wpWordStart,oldplace)); |
617 » » » » » » bLatinWord = FALSE; | 617 » » » » » » bLatinWord = false; |
618 sWord.Empty(); | 618 sWord.Empty(); |
619 } | 619 } |
620 } | 620 } |
621 } | 621 } |
622 | 622 |
623 if (bLatinWord) | 623 if (bLatinWord) |
624 { | 624 { |
625 if (!pSpellCheck->CheckWord(sWord)) | 625 if (!pSpellCheck->CheckWord(sWord)) |
626 sRet << GetWordSpellCheckAppearanceStrea
m(pIterator,ptOffset,CPVT_WordRange(wpWordStart,oldplace)); | 626 sRet << GetWordSpellCheckAppearanceStrea
m(pIterator,ptOffset,CPVT_WordRange(wpWordStart,oldplace)); |
627 | 627 |
628 » » » » bLatinWord = FALSE; | 628 » » » » bLatinWord = false; |
629 sWord.Empty(); | 629 sWord.Empty(); |
630 } | 630 } |
631 } | 631 } |
632 } | 632 } |
633 | 633 |
634 return sRet.GetByteString(); | 634 return sRet.GetByteString(); |
635 } | 635 } |
636 | 636 |
637 CFX_ByteString CPWL_Utils::GetTextAppStream(const CPDF_Rect & rcBBox,IFX_Edit_Fo
ntMap * pFontMap, | 637 CFX_ByteString CPWL_Utils::GetTextAppStream(const CPDF_Rect & rcBBox,IFX_Edit_Fo
ntMap * pFontMap, |
638
const CFX_WideString & sText, int32_t nAlignment
H, int32_t nAlignmentV, | 638
const CFX_WideString & sText, int32_t nAlignment
H, int32_t nAlignmentV, |
639 » » » » » » » » » »
» » » » FX_FLOAT fFontSize, FX_BOOL bMultiLine, FX_BOOL
bAutoReturn, const CPWL_Color & crText) | 639 » » » » » » » » » »
» » » » FX_FLOAT fFontSize, bool bMultiLine, bool bAutoR
eturn, const CPWL_Color & crText) |
640 { | 640 { |
641 CFX_ByteTextBuf sRet; | 641 CFX_ByteTextBuf sRet; |
642 | 642 |
643 if (IFX_Edit * pEdit = IFX_Edit::NewEdit()) | 643 if (IFX_Edit * pEdit = IFX_Edit::NewEdit()) |
644 { | 644 { |
645 pEdit->SetFontMap(pFontMap); | 645 pEdit->SetFontMap(pFontMap); |
646 pEdit->SetPlateRect(rcBBox); | 646 pEdit->SetPlateRect(rcBBox); |
647 pEdit->SetAlignmentH(nAlignmentH); | 647 pEdit->SetAlignmentH(nAlignmentH); |
648 pEdit->SetAlignmentV(nAlignmentV); | 648 pEdit->SetAlignmentV(nAlignmentV); |
649 pEdit->SetMultiLine(bMultiLine); | 649 pEdit->SetMultiLine(bMultiLine); |
650 pEdit->SetAutoReturn(bAutoReturn); | 650 pEdit->SetAutoReturn(bAutoReturn); |
651 if (IsFloatZero(fFontSize)) | 651 if (IsFloatZero(fFontSize)) |
652 » » » pEdit->SetAutoFontSize(TRUE); | 652 » » » pEdit->SetAutoFontSize(true); |
653 else | 653 else |
654 pEdit->SetFontSize(fFontSize); | 654 pEdit->SetFontSize(fFontSize); |
655 | 655 |
656 pEdit->Initialize(); | 656 pEdit->Initialize(); |
657 pEdit->SetText(sText.c_str()); | 657 pEdit->SetText(sText.c_str()); |
658 | 658 |
659 CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(pEdit, CPDF_
Point(0.0f,0.0f)); | 659 CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(pEdit, CPDF_
Point(0.0f,0.0f)); |
660 if (sEdit.GetLength() > 0) | 660 if (sEdit.GetLength() > 0) |
661 { | 661 { |
662 sRet << "BT\n" << CPWL_Utils::GetColorAppStream(crText)
<< sEdit << "ET\n"; | 662 sRet << "BT\n" << CPWL_Utils::GetColorAppStream(crText)
<< sEdit << "ET\n"; |
(...skipping 13 matching lines...) Expand all Loading... |
676
FX_FLOAT fFontSize, | 676
FX_FLOAT fFontSize, |
677
int32_t nLayOut) | 677
int32_t nLayOut) |
678 { | 678 { |
679 const FX_FLOAT fAutoFontScale = 1.0f / 3.0f; | 679 const FX_FLOAT fAutoFontScale = 1.0f / 3.0f; |
680 | 680 |
681 if (IFX_Edit * pEdit = IFX_Edit::NewEdit()) | 681 if (IFX_Edit * pEdit = IFX_Edit::NewEdit()) |
682 { | 682 { |
683 pEdit->SetFontMap(pFontMap); | 683 pEdit->SetFontMap(pFontMap); |
684 pEdit->SetAlignmentH(1); | 684 pEdit->SetAlignmentH(1); |
685 pEdit->SetAlignmentV(1); | 685 pEdit->SetAlignmentV(1); |
686 » » pEdit->SetMultiLine(FALSE); | 686 » » pEdit->SetMultiLine(false); |
687 » » pEdit->SetAutoReturn(FALSE); | 687 » » pEdit->SetAutoReturn(false); |
688 if (IsFloatZero(fFontSize)) | 688 if (IsFloatZero(fFontSize)) |
689 » » » pEdit->SetAutoFontSize(TRUE); | 689 » » » pEdit->SetAutoFontSize(true); |
690 else | 690 else |
691 pEdit->SetFontSize(fFontSize); | 691 pEdit->SetFontSize(fFontSize); |
692 | 692 |
693 pEdit->Initialize(); | 693 pEdit->Initialize(); |
694 pEdit->SetText(sLabel.c_str()); | 694 pEdit->SetText(sLabel.c_str()); |
695 | 695 |
696 CPDF_Rect rcLabelContent = pEdit->GetContentRect(); | 696 CPDF_Rect rcLabelContent = pEdit->GetContentRect(); |
697 CPWL_Icon Icon; | 697 CPWL_Icon Icon; |
698 PWL_CREATEPARAM cp; | 698 PWL_CREATEPARAM cp; |
699 cp.dwFlags = PWS_VISIBLE; | 699 cp.dwFlags = PWS_VISIBLE; |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 case PPBL_LABELOVERICON: | 885 case PPBL_LABELOVERICON: |
886 rcLabel = rcBBox; | 886 rcLabel = rcBBox; |
887 rcIcon = rcBBox; | 887 rcIcon = rcBBox; |
888 break; | 888 break; |
889 } | 889 } |
890 | 890 |
891 CFX_ByteTextBuf sAppStream,sTemp; | 891 CFX_ByteTextBuf sAppStream,sTemp; |
892 | 892 |
893 if (!rcIcon.IsEmpty()) | 893 if (!rcIcon.IsEmpty()) |
894 { | 894 { |
895 » » » Icon.Move(rcIcon, FALSE, FALSE); | 895 » » » Icon.Move(rcIcon, false, false); |
896 sTemp << Icon.GetImageAppStream(); | 896 sTemp << Icon.GetImageAppStream(); |
897 } | 897 } |
898 | 898 |
899 Icon.Destroy(); | 899 Icon.Destroy(); |
900 | 900 |
901 if (!rcLabel.IsEmpty()) | 901 if (!rcLabel.IsEmpty()) |
902 { | 902 { |
903 pEdit->SetPlateRect(rcLabel); | 903 pEdit->SetPlateRect(rcLabel); |
904 CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(pEdi
t,CPDF_Point(0.0f,0.0f)); | 904 CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(pEdi
t,CPDF_Point(0.0f,0.0f)); |
905 if (sEdit.GetLength() > 0) | 905 if (sEdit.GetLength() > 0) |
(...skipping 10 matching lines...) Expand all Loading... |
916 << rcBBox.right - rcBBox.left << " " << rcBBox.t
op - rcBBox.bottom << " re W n\n"; | 916 << rcBBox.right - rcBBox.left << " " << rcBBox.t
op - rcBBox.bottom << " re W n\n"; |
917 sAppStream << sTemp << "Q\n"; | 917 sAppStream << sTemp << "Q\n"; |
918 } | 918 } |
919 | 919 |
920 return sAppStream.GetByteString(); | 920 return sAppStream.GetByteString(); |
921 } | 921 } |
922 | 922 |
923 return ""; | 923 return ""; |
924 } | 924 } |
925 | 925 |
926 CFX_ByteString CPWL_Utils::GetColorAppStream(const CPWL_Color & color,const FX_B
OOL & bFillOrStroke) | 926 CFX_ByteString CPWL_Utils::GetColorAppStream(const CPWL_Color & color,const bool
& bFillOrStroke) |
927 { | 927 { |
928 CFX_ByteTextBuf sColorStream; | 928 CFX_ByteTextBuf sColorStream; |
929 | 929 |
930 switch (color.nColorType) | 930 switch (color.nColorType) |
931 { | 931 { |
932 case COLORTYPE_RGB: | 932 case COLORTYPE_RGB: |
933 sColorStream << color.fColor1 << " " << color.fColor2 << " " <<
color.fColor3 << " " | 933 sColorStream << color.fColor1 << " " << color.fColor2 << " " <<
color.fColor3 << " " |
934 << (bFillOrStroke ? "rg" : "RG") << "\n"; | 934 << (bFillOrStroke ? "rg" : "RG") << "\n"; |
935 break; | 935 break; |
936 case COLORTYPE_GRAY: | 936 case COLORTYPE_GRAY: |
(...skipping 23 matching lines...) Expand all Loading... |
960 if (fWidth > 0.0f) | 960 if (fWidth > 0.0f) |
961 { | 961 { |
962 FX_FLOAT fHalfWidth = fWidth / 2.0f; | 962 FX_FLOAT fHalfWidth = fWidth / 2.0f; |
963 | 963 |
964 sAppStream << "q\n"; | 964 sAppStream << "q\n"; |
965 | 965 |
966 switch (nStyle) | 966 switch (nStyle) |
967 { | 967 { |
968 default: | 968 default: |
969 case PBS_SOLID: | 969 case PBS_SOLID: |
970 » » » sColor = CPWL_Utils::GetColorAppStream(color,TRUE); | 970 » » » sColor = CPWL_Utils::GetColorAppStream(color,true); |
971 if (sColor.GetLength() > 0) | 971 if (sColor.GetLength() > 0) |
972 { | 972 { |
973 sAppStream << sColor; | 973 sAppStream << sColor; |
974 sAppStream << fLeft << " " << fBottom << " " <<
fRight - fLeft << " " << fTop - fBottom << " re\n"; | 974 sAppStream << fLeft << " " << fBottom << " " <<
fRight - fLeft << " " << fTop - fBottom << " re\n"; |
975 sAppStream << fLeft + fWidth << " " << fBottom +
fWidth << " " | 975 sAppStream << fLeft + fWidth << " " << fBottom +
fWidth << " " |
976 << fRight - fLeft - fWidth * 2 << " " <<
fTop - fBottom - fWidth * 2 << " re\n"; | 976 << fRight - fLeft - fWidth * 2 << " " <<
fTop - fBottom - fWidth * 2 << " re\n"; |
977 sAppStream << "f*\n"; | 977 sAppStream << "f*\n"; |
978 } | 978 } |
979 break; | 979 break; |
980 case PBS_DASH: | 980 case PBS_DASH: |
981 » » » sColor = CPWL_Utils::GetColorAppStream(color,FALSE); | 981 » » » sColor = CPWL_Utils::GetColorAppStream(color,false); |
982 if (sColor.GetLength() > 0) | 982 if (sColor.GetLength() > 0) |
983 { | 983 { |
984 sAppStream << sColor; | 984 sAppStream << sColor; |
985 sAppStream << fWidth << " w" << " [" << dash.nDa
sh << " " << dash.nGap << "] " << dash.nPhase << " d\n"; | 985 sAppStream << fWidth << " w" << " [" << dash.nDa
sh << " " << dash.nGap << "] " << dash.nPhase << " d\n"; |
986 sAppStream << fLeft + fWidth / 2 << " " << fBott
om + fWidth / 2 << " m\n"; | 986 sAppStream << fLeft + fWidth / 2 << " " << fBott
om + fWidth / 2 << " m\n"; |
987 sAppStream << fLeft + fWidth / 2 << " " << fTop
- fWidth / 2 << " l\n"; | 987 sAppStream << fLeft + fWidth / 2 << " " << fTop
- fWidth / 2 << " l\n"; |
988 sAppStream << fRight - fWidth / 2 << " " << fTop
- fWidth / 2 << " l\n"; | 988 sAppStream << fRight - fWidth / 2 << " " << fTop
- fWidth / 2 << " l\n"; |
989 sAppStream << fRight - fWidth / 2 << " " << fBot
tom + fWidth / 2 << " l\n"; | 989 sAppStream << fRight - fWidth / 2 << " " << fBot
tom + fWidth / 2 << " l\n"; |
990 sAppStream << fLeft + fWidth / 2 << " " << fBott
om + fWidth / 2 << " l S\n"; | 990 sAppStream << fLeft + fWidth / 2 << " " << fBott
om + fWidth / 2 << " l S\n"; |
991 } | 991 } |
992 break; | 992 break; |
993 case PBS_BEVELED: | 993 case PBS_BEVELED: |
994 case PBS_INSET: | 994 case PBS_INSET: |
995 » » » sColor = CPWL_Utils::GetColorAppStream(crLeftTop,TRUE); | 995 » » » sColor = CPWL_Utils::GetColorAppStream(crLeftTop,true); |
996 if (sColor.GetLength() > 0) | 996 if (sColor.GetLength() > 0) |
997 { | 997 { |
998 sAppStream << sColor; | 998 sAppStream << sColor; |
999 sAppStream << fLeft + fHalfWidth << " " << fBott
om + fHalfWidth << " m\n"; | 999 sAppStream << fLeft + fHalfWidth << " " << fBott
om + fHalfWidth << " m\n"; |
1000 sAppStream << fLeft + fHalfWidth << " " << fTop
- fHalfWidth << " l\n"; | 1000 sAppStream << fLeft + fHalfWidth << " " << fTop
- fHalfWidth << " l\n"; |
1001 sAppStream << fRight - fHalfWidth << " " << fTop
- fHalfWidth << " l\n"; | 1001 sAppStream << fRight - fHalfWidth << " " << fTop
- fHalfWidth << " l\n"; |
1002 sAppStream << fRight - fHalfWidth * 2 << " " <<
fTop - fHalfWidth * 2 << " l\n"; | 1002 sAppStream << fRight - fHalfWidth * 2 << " " <<
fTop - fHalfWidth * 2 << " l\n"; |
1003 sAppStream << fLeft + fHalfWidth * 2 << " " << f
Top - fHalfWidth * 2 << " l\n"; | 1003 sAppStream << fLeft + fHalfWidth * 2 << " " << f
Top - fHalfWidth * 2 << " l\n"; |
1004 sAppStream << fLeft + fHalfWidth * 2 << " " << f
Bottom + fHalfWidth * 2 << " l f\n"; | 1004 sAppStream << fLeft + fHalfWidth * 2 << " " << f
Bottom + fHalfWidth * 2 << " l f\n"; |
1005 } | 1005 } |
1006 | 1006 |
1007 » » » sColor = CPWL_Utils::GetColorAppStream(crRightBottom,TRU
E); | 1007 » » » sColor = CPWL_Utils::GetColorAppStream(crRightBottom,tru
e); |
1008 if (sColor.GetLength() > 0) | 1008 if (sColor.GetLength() > 0) |
1009 { | 1009 { |
1010 sAppStream << sColor; | 1010 sAppStream << sColor; |
1011 sAppStream << fRight - fHalfWidth << " " <<
fTop - fHalfWidth << " m\n"; | 1011 sAppStream << fRight - fHalfWidth << " " <<
fTop - fHalfWidth << " m\n"; |
1012 sAppStream << fRight - fHalfWidth << " " <<
fBottom + fHalfWidth << " l\n"; | 1012 sAppStream << fRight - fHalfWidth << " " <<
fBottom + fHalfWidth << " l\n"; |
1013 sAppStream << fLeft + fHalfWidth << " " <<
fBottom + fHalfWidth << " l\n"; | 1013 sAppStream << fLeft + fHalfWidth << " " <<
fBottom + fHalfWidth << " l\n"; |
1014 sAppStream << fLeft + fHalfWidth * 2 << " " << f
Bottom + fHalfWidth * 2 << " l\n"; | 1014 sAppStream << fLeft + fHalfWidth * 2 << " " << f
Bottom + fHalfWidth * 2 << " l\n"; |
1015 sAppStream << fRight - fHalfWidth * 2 << " " <<
fBottom + fHalfWidth * 2 << " l\n"; | 1015 sAppStream << fRight - fHalfWidth * 2 << " " <<
fBottom + fHalfWidth * 2 << " l\n"; |
1016 sAppStream << fRight - fHalfWidth * 2 << " " <<
fTop - fHalfWidth * 2 << " l f\n"; | 1016 sAppStream << fRight - fHalfWidth * 2 << " " <<
fTop - fHalfWidth * 2 << " l f\n"; |
1017 } | 1017 } |
1018 | 1018 |
1019 » » » sColor = CPWL_Utils::GetColorAppStream(color,TRUE); | 1019 » » » sColor = CPWL_Utils::GetColorAppStream(color,true); |
1020 if (sColor.GetLength() > 0) | 1020 if (sColor.GetLength() > 0) |
1021 { | 1021 { |
1022 sAppStream << sColor; | 1022 sAppStream << sColor; |
1023 sAppStream << fLeft << " " << fBottom << " " <<
fRight - fLeft << " " << fTop - fBottom << " re\n"; | 1023 sAppStream << fLeft << " " << fBottom << " " <<
fRight - fLeft << " " << fTop - fBottom << " re\n"; |
1024 sAppStream << fLeft + fHalfWidth << " " << fBott
om + fHalfWidth << " " | 1024 sAppStream << fLeft + fHalfWidth << " " << fBott
om + fHalfWidth << " " |
1025 << fRight - fLeft - fHalfWidth * 2 << "
" << fTop - fBottom - fHalfWidth * 2 << " re f*\n"; | 1025 << fRight - fLeft - fHalfWidth * 2 << "
" << fTop - fBottom - fHalfWidth * 2 << " re f*\n"; |
1026 } | 1026 } |
1027 break; | 1027 break; |
1028 case PBS_UNDERLINED: | 1028 case PBS_UNDERLINED: |
1029 » » » sColor = CPWL_Utils::GetColorAppStream(color,FALSE); | 1029 » » » sColor = CPWL_Utils::GetColorAppStream(color,false); |
1030 if (sColor.GetLength() > 0) | 1030 if (sColor.GetLength() > 0) |
1031 { | 1031 { |
1032 sAppStream << sColor; | 1032 sAppStream << sColor; |
1033 sAppStream << fWidth << " w\n"; | 1033 sAppStream << fWidth << " w\n"; |
1034 sAppStream << fLeft << " " << fBottom + fWidth /
2 << " m\n"; | 1034 sAppStream << fLeft << " " << fBottom + fWidth /
2 << " m\n"; |
1035 sAppStream << fRight << " " << fBottom + fWidth
/ 2 << " l S\n"; | 1035 sAppStream << fRight << " " << fBottom + fWidth
/ 2 << " l S\n"; |
1036 } | 1036 } |
1037 break; | 1037 break; |
1038 } | 1038 } |
1039 | 1039 |
(...skipping 18 matching lines...) Expand all Loading... |
1058 if (fWidth > 0.0f) | 1058 if (fWidth > 0.0f) |
1059 { | 1059 { |
1060 sAppStream << "q\n"; | 1060 sAppStream << "q\n"; |
1061 | 1061 |
1062 switch (nStyle) | 1062 switch (nStyle) |
1063 { | 1063 { |
1064 default: | 1064 default: |
1065 case PBS_SOLID: | 1065 case PBS_SOLID: |
1066 case PBS_UNDERLINED: | 1066 case PBS_UNDERLINED: |
1067 { | 1067 { |
1068 » » » » sColor = CPWL_Utils::GetColorAppStream(color,FAL
SE); | 1068 » » » » sColor = CPWL_Utils::GetColorAppStream(color,fal
se); |
1069 if (sColor.GetLength() > 0) | 1069 if (sColor.GetLength() > 0) |
1070 { | 1070 { |
1071 sAppStream << "q\n" << fWidth << " w\n"
<< sColor | 1071 sAppStream << "q\n" << fWidth << " w\n"
<< sColor |
1072 << CPWL_Utils::GetAP_Circle(CPWL
_Utils::DeflateRect(rect,fWidth / 2.0f)) | 1072 << CPWL_Utils::GetAP_Circle(CPWL
_Utils::DeflateRect(rect,fWidth / 2.0f)) |
1073 << " S\nQ\n"; | 1073 << " S\nQ\n"; |
1074 } | 1074 } |
1075 } | 1075 } |
1076 break; | 1076 break; |
1077 case PBS_DASH: | 1077 case PBS_DASH: |
1078 { | 1078 { |
1079 » » » » sColor = CPWL_Utils::GetColorAppStream(color,FAL
SE); | 1079 » » » » sColor = CPWL_Utils::GetColorAppStream(color,fal
se); |
1080 if (sColor.GetLength() > 0) | 1080 if (sColor.GetLength() > 0) |
1081 { | 1081 { |
1082 sAppStream << "q\n" << fWidth << " w\n" | 1082 sAppStream << "q\n" << fWidth << " w\n" |
1083 << "[" << dash.nDash << " " << d
ash.nGap << "] " << dash.nPhase << " d\n" | 1083 << "[" << dash.nDash << " " << d
ash.nGap << "] " << dash.nPhase << " d\n" |
1084 << sColor << CPWL_Utils::GetAP_C
ircle(CPWL_Utils::DeflateRect(rect,fWidth / 2.0f)) | 1084 << sColor << CPWL_Utils::GetAP_C
ircle(CPWL_Utils::DeflateRect(rect,fWidth / 2.0f)) |
1085 << " S\nQ\n"; | 1085 << " S\nQ\n"; |
1086 } | 1086 } |
1087 } | 1087 } |
1088 break; | 1088 break; |
1089 case PBS_BEVELED: | 1089 case PBS_BEVELED: |
1090 { | 1090 { |
1091 FX_FLOAT fHalfWidth = fWidth / 2.0f; | 1091 FX_FLOAT fHalfWidth = fWidth / 2.0f; |
1092 | 1092 |
1093 » » » » sColor = CPWL_Utils::GetColorAppStream(color,FAL
SE); | 1093 » » » » sColor = CPWL_Utils::GetColorAppStream(color,fal
se); |
1094 if (sColor.GetLength() > 0) | 1094 if (sColor.GetLength() > 0) |
1095 { | 1095 { |
1096 sAppStream << "q\n" << fHalfWidth << " w
\n" | 1096 sAppStream << "q\n" << fHalfWidth << " w
\n" |
1097 << sColor << CPWL_Utils::GetAP_C
ircle(rect) | 1097 << sColor << CPWL_Utils::GetAP_C
ircle(rect) |
1098 << " S\nQ\n"; | 1098 << " S\nQ\n"; |
1099 } | 1099 } |
1100 | 1100 |
1101 » » » » sColor = CPWL_Utils::GetColorAppStream(crLeftTop
,FALSE); | 1101 » » » » sColor = CPWL_Utils::GetColorAppStream(crLeftTop
,false); |
1102 if (sColor.GetLength() > 0) | 1102 if (sColor.GetLength() > 0) |
1103 { | 1103 { |
1104 sAppStream << "q\n" << fHalfWidth << " w
\n" | 1104 sAppStream << "q\n" << fHalfWidth << " w
\n" |
1105 << sColor << CPWL_Utils::GetAP_H
alfCircle(CPWL_Utils::DeflateRect(rect,fHalfWidth * 0.75f),PWL_PI/4.0f) | 1105 << sColor << CPWL_Utils::GetAP_H
alfCircle(CPWL_Utils::DeflateRect(rect,fHalfWidth * 0.75f),PWL_PI/4.0f) |
1106 << " S\nQ\n"; | 1106 << " S\nQ\n"; |
1107 } | 1107 } |
1108 | 1108 |
1109 » » » » sColor = CPWL_Utils::GetColorAppStream(crRightBo
ttom,FALSE); | 1109 » » » » sColor = CPWL_Utils::GetColorAppStream(crRightBo
ttom,false); |
1110 if (sColor.GetLength() > 0) | 1110 if (sColor.GetLength() > 0) |
1111 { | 1111 { |
1112 sAppStream << "q\n" << fHalfWidth << " w
\n" | 1112 sAppStream << "q\n" << fHalfWidth << " w
\n" |
1113 << sColor << CPWL_Utils::GetAP_H
alfCircle(CPWL_Utils::DeflateRect(rect,fHalfWidth * 0.75f),PWL_PI*5/4.0f) | 1113 << sColor << CPWL_Utils::GetAP_H
alfCircle(CPWL_Utils::DeflateRect(rect,fHalfWidth * 0.75f),PWL_PI*5/4.0f) |
1114 << " S\nQ\n"; | 1114 << " S\nQ\n"; |
1115 } | 1115 } |
1116 } | 1116 } |
1117 break; | 1117 break; |
1118 case PBS_INSET: | 1118 case PBS_INSET: |
1119 { | 1119 { |
1120 FX_FLOAT fHalfWidth = fWidth / 2.0f; | 1120 FX_FLOAT fHalfWidth = fWidth / 2.0f; |
1121 | 1121 |
1122 » » » » sColor = CPWL_Utils::GetColorAppStream(color,FAL
SE); | 1122 » » » » sColor = CPWL_Utils::GetColorAppStream(color,fal
se); |
1123 if (sColor.GetLength() > 0) | 1123 if (sColor.GetLength() > 0) |
1124 { | 1124 { |
1125 sAppStream << "q\n" << fHalfWidth << " w
\n" | 1125 sAppStream << "q\n" << fHalfWidth << " w
\n" |
1126 << sColor << CPWL_Utils::GetAP_C
ircle(rect) | 1126 << sColor << CPWL_Utils::GetAP_C
ircle(rect) |
1127 << " S\nQ\n"; | 1127 << " S\nQ\n"; |
1128 } | 1128 } |
1129 | 1129 |
1130 » » » » sColor = CPWL_Utils::GetColorAppStream(crLeftTop
,FALSE); | 1130 » » » » sColor = CPWL_Utils::GetColorAppStream(crLeftTop
,false); |
1131 if (sColor.GetLength() > 0) | 1131 if (sColor.GetLength() > 0) |
1132 { | 1132 { |
1133 sAppStream << "q\n" << fHalfWidth << " w
\n" | 1133 sAppStream << "q\n" << fHalfWidth << " w
\n" |
1134 << sColor << CPWL_Utils::GetAP_H
alfCircle(CPWL_Utils::DeflateRect(rect,fHalfWidth * 0.75f),PWL_PI/4.0f) | 1134 << sColor << CPWL_Utils::GetAP_H
alfCircle(CPWL_Utils::DeflateRect(rect,fHalfWidth * 0.75f),PWL_PI/4.0f) |
1135 << " S\nQ\n"; | 1135 << " S\nQ\n"; |
1136 } | 1136 } |
1137 | 1137 |
1138 » » » » sColor = CPWL_Utils::GetColorAppStream(crRightBo
ttom,FALSE); | 1138 » » » » sColor = CPWL_Utils::GetColorAppStream(crRightBo
ttom,false); |
1139 if (sColor.GetLength() > 0) | 1139 if (sColor.GetLength() > 0) |
1140 { | 1140 { |
1141 sAppStream << "q\n" << fHalfWidth << " w
\n" | 1141 sAppStream << "q\n" << fHalfWidth << " w
\n" |
1142 << sColor << CPWL_Utils::GetAP_H
alfCircle(CPWL_Utils::DeflateRect(rect,fHalfWidth * 0.75f),PWL_PI*5/4.0f) | 1142 << sColor << CPWL_Utils::GetAP_H
alfCircle(CPWL_Utils::DeflateRect(rect,fHalfWidth * 0.75f),PWL_PI*5/4.0f) |
1143 << " S\nQ\n"; | 1143 << " S\nQ\n"; |
1144 } | 1144 } |
1145 } | 1145 } |
1146 break; | 1146 break; |
1147 } | 1147 } |
1148 | 1148 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1201 sRet.fColor4 /= fColorDevide; | 1201 sRet.fColor4 /= fColorDevide; |
1202 break; | 1202 break; |
1203 } | 1203 } |
1204 | 1204 |
1205 return sRet; | 1205 return sRet; |
1206 } | 1206 } |
1207 | 1207 |
1208 CFX_ByteString CPWL_Utils::GetAppStream_Check(const CPDF_Rect & rcBBox, const CP
WL_Color & crText) | 1208 CFX_ByteString CPWL_Utils::GetAppStream_Check(const CPDF_Rect & rcBBox, const CP
WL_Color & crText) |
1209 { | 1209 { |
1210 CFX_ByteTextBuf sAP; | 1210 CFX_ByteTextBuf sAP; |
1211 » sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText,TRUE) << CPWL_Utils
::GetAP_Check(rcBBox) << "f\nQ\n"; | 1211 » sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText,true) << CPWL_Utils
::GetAP_Check(rcBBox) << "f\nQ\n"; |
1212 return sAP.GetByteString(); | 1212 return sAP.GetByteString(); |
1213 } | 1213 } |
1214 | 1214 |
1215 CFX_ByteString CPWL_Utils::GetAppStream_Circle(const CPDF_Rect & rcBBox, const C
PWL_Color & crText) | 1215 CFX_ByteString CPWL_Utils::GetAppStream_Circle(const CPDF_Rect & rcBBox, const C
PWL_Color & crText) |
1216 { | 1216 { |
1217 CFX_ByteTextBuf sAP; | 1217 CFX_ByteTextBuf sAP; |
1218 » sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText,TRUE) << CPWL_Utils
::GetAP_Circle(rcBBox) << "f\nQ\n"; | 1218 » sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText,true) << CPWL_Utils
::GetAP_Circle(rcBBox) << "f\nQ\n"; |
1219 return sAP.GetByteString(); | 1219 return sAP.GetByteString(); |
1220 } | 1220 } |
1221 | 1221 |
1222 CFX_ByteString CPWL_Utils::GetAppStream_Cross(const CPDF_Rect & rcBBox, const CP
WL_Color & crText) | 1222 CFX_ByteString CPWL_Utils::GetAppStream_Cross(const CPDF_Rect & rcBBox, const CP
WL_Color & crText) |
1223 { | 1223 { |
1224 CFX_ByteTextBuf sAP; | 1224 CFX_ByteTextBuf sAP; |
1225 » sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText,FALSE) << CPWL_Util
s::GetAP_Cross(rcBBox) << "S\nQ\n"; | 1225 » sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText,false) << CPWL_Util
s::GetAP_Cross(rcBBox) << "S\nQ\n"; |
1226 return sAP.GetByteString(); | 1226 return sAP.GetByteString(); |
1227 } | 1227 } |
1228 | 1228 |
1229 CFX_ByteString CPWL_Utils::GetAppStream_Diamond(const CPDF_Rect & rcBBox, const
CPWL_Color & crText) | 1229 CFX_ByteString CPWL_Utils::GetAppStream_Diamond(const CPDF_Rect & rcBBox, const
CPWL_Color & crText) |
1230 { | 1230 { |
1231 CFX_ByteTextBuf sAP; | 1231 CFX_ByteTextBuf sAP; |
1232 » sAP << "q\n1 w\n" << CPWL_Utils::GetColorAppStream(crText,TRUE) << CPWL_
Utils::GetAP_Diamond(rcBBox) << "f\nQ\n"; | 1232 » sAP << "q\n1 w\n" << CPWL_Utils::GetColorAppStream(crText,true) << CPWL_
Utils::GetAP_Diamond(rcBBox) << "f\nQ\n"; |
1233 return sAP.GetByteString(); | 1233 return sAP.GetByteString(); |
1234 } | 1234 } |
1235 | 1235 |
1236 CFX_ByteString CPWL_Utils::GetAppStream_Square(const CPDF_Rect & rcBBox, const C
PWL_Color & crText) | 1236 CFX_ByteString CPWL_Utils::GetAppStream_Square(const CPDF_Rect & rcBBox, const C
PWL_Color & crText) |
1237 { | 1237 { |
1238 CFX_ByteTextBuf sAP; | 1238 CFX_ByteTextBuf sAP; |
1239 » sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText,TRUE) << CPWL_Utils
::GetAP_Square(rcBBox) << "f\nQ\n"; | 1239 » sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText,true) << CPWL_Utils
::GetAP_Square(rcBBox) << "f\nQ\n"; |
1240 return sAP.GetByteString(); | 1240 return sAP.GetByteString(); |
1241 } | 1241 } |
1242 | 1242 |
1243 CFX_ByteString CPWL_Utils::GetAppStream_Star(const CPDF_Rect & rcBBox, const CPW
L_Color & crText) | 1243 CFX_ByteString CPWL_Utils::GetAppStream_Star(const CPDF_Rect & rcBBox, const CPW
L_Color & crText) |
1244 { | 1244 { |
1245 CFX_ByteTextBuf sAP; | 1245 CFX_ByteTextBuf sAP; |
1246 » sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText,TRUE) << CPWL_Utils
::GetAP_Star(rcBBox) << "f\nQ\n"; | 1246 » sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText,true) << CPWL_Utils
::GetAP_Star(rcBBox) << "f\nQ\n"; |
1247 return sAP.GetByteString(); | 1247 return sAP.GetByteString(); |
1248 } | 1248 } |
1249 | 1249 |
1250 CFX_ByteString CPWL_Utils::GetCheckBoxAppStream(const CPDF_Rect & rcBBox, | 1250 CFX_ByteString CPWL_Utils::GetCheckBoxAppStream(const CPDF_Rect & rcBBox, |
1251
int32_t nStyle, | 1251
int32_t nStyle, |
1252
const CPWL_Color & crText) | 1252
const CPWL_Color & crText) |
1253 { | 1253 { |
1254 CPDF_Rect rcCenter = GetCenterSquare(rcBBox); | 1254 CPDF_Rect rcCenter = GetCenterSquare(rcBBox); |
1255 switch (nStyle) | 1255 switch (nStyle) |
1256 { | 1256 { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1292 return GetAppStream_Star(ScaleRect(rcCenter,2.0f/3.0f),crText); | 1292 return GetAppStream_Star(ScaleRect(rcCenter,2.0f/3.0f),crText); |
1293 } | 1293 } |
1294 } | 1294 } |
1295 | 1295 |
1296 CFX_ByteString CPWL_Utils::GetDropButtonAppStream(const CPDF_Rect & rcBBox) | 1296 CFX_ByteString CPWL_Utils::GetDropButtonAppStream(const CPDF_Rect & rcBBox) |
1297 { | 1297 { |
1298 CFX_ByteTextBuf sAppStream; | 1298 CFX_ByteTextBuf sAppStream; |
1299 | 1299 |
1300 if (!rcBBox.IsEmpty()) | 1300 if (!rcBBox.IsEmpty()) |
1301 { | 1301 { |
1302 » » sAppStream << "q\n" << CPWL_Utils::GetColorAppStream(CPWL_Color(
COLORTYPE_RGB,220.0f/255.0f,220.0f/255.0f,220.0f/255.0f),TRUE); | 1302 » » sAppStream << "q\n" << CPWL_Utils::GetColorAppStream(CPWL_Color(
COLORTYPE_RGB,220.0f/255.0f,220.0f/255.0f,220.0f/255.0f),true); |
1303 sAppStream << rcBBox.left << " " << rcBBox.bottom << " " | 1303 sAppStream << rcBBox.left << " " << rcBBox.bottom << " " |
1304 << rcBBox.right - rcBBox.left << " " << rcBBox.t
op - rcBBox.bottom << " re f\n"; | 1304 << rcBBox.right - rcBBox.left << " " << rcBBox.t
op - rcBBox.bottom << " re f\n"; |
1305 sAppStream << "Q\n"; | 1305 sAppStream << "Q\n"; |
1306 | 1306 |
1307 sAppStream << "q\n" << | 1307 sAppStream << "q\n" << |
1308 CPWL_Utils::GetBorderAppStream(rcBBox,2,CPWL_Color(COLOR
TYPE_GRAY,0),CPWL_Color(COLORTYPE_GRAY,1),CPWL_Color(COLORTYPE_GRAY,0.5),PBS_BEV
ELED,CPWL_Dash(3,0,0)) | 1308 CPWL_Utils::GetBorderAppStream(rcBBox,2,CPWL_Color(COLOR
TYPE_GRAY,0),CPWL_Color(COLORTYPE_GRAY,1),CPWL_Color(COLORTYPE_GRAY,0.5),PBS_BEV
ELED,CPWL_Dash(3,0,0)) |
1309 << "Q\n"; | 1309 << "Q\n"; |
1310 | 1310 |
1311 CPDF_Point ptCenter = CPDF_Point((rcBBox.left + rcBBox.right)/2,
(rcBBox.top + rcBBox.bottom)/2); | 1311 CPDF_Point ptCenter = CPDF_Point((rcBBox.left + rcBBox.right)/2,
(rcBBox.top + rcBBox.bottom)/2); |
1312 if (IsFloatBigger(rcBBox.right - rcBBox.left,6) && IsFloatBigger
(rcBBox.top - rcBBox.bottom,6)) | 1312 if (IsFloatBigger(rcBBox.right - rcBBox.left,6) && IsFloatBigger
(rcBBox.top - rcBBox.bottom,6)) |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1467 pDevice->DrawPath(&path, pUser2Device, &gsd, 0, color, FXFILL_ALTERNATE)
; | 1467 pDevice->DrawPath(&path, pUser2Device, &gsd, 0, color, FXFILL_ALTERNATE)
; |
1468 } | 1468 } |
1469 | 1469 |
1470 void CPWL_Utils::DrawFillRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Devi
ce,const CPDF_Rect & rect, | 1470 void CPWL_Utils::DrawFillRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Devi
ce,const CPDF_Rect & rect, |
1471 const CPWL_Color & col
or, int32_t nTransparancy) | 1471 const CPWL_Color & col
or, int32_t nTransparancy) |
1472 { | 1472 { |
1473 CPWL_Utils::DrawFillRect(pDevice,pUser2Device,rect,PWLColorToFXColor(col
or,nTransparancy)); | 1473 CPWL_Utils::DrawFillRect(pDevice,pUser2Device,rect,PWLColorToFXColor(col
or,nTransparancy)); |
1474 } | 1474 } |
1475 | 1475 |
1476 void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device
, | 1476 void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device
, |
1477 » » » » » » » » » »
» » » » FX_BOOL bVertical, FX_BOOL bHorizontal, CPDF_Rec
t rect, | 1477 » » » » » » » » » »
» » » » bool bVertical, bool bHorizontal, CPDF_Rect rect
, |
1478
int32_t nTransparancy, int32_t nStartGray, int32
_t nEndGray) | 1478
int32_t nTransparancy, int32_t nStartGray, int32
_t nEndGray) |
1479 { | 1479 { |
1480 FX_FLOAT fStepGray = 1.0f; | 1480 FX_FLOAT fStepGray = 1.0f; |
1481 | 1481 |
1482 if (bVertical) | 1482 if (bVertical) |
1483 { | 1483 { |
1484 fStepGray = (nEndGray - nStartGray) / rect.Height(); | 1484 fStepGray = (nEndGray - nStartGray) / rect.Height(); |
1485 | 1485 |
1486 for (FX_FLOAT fy=rect.bottom+0.5f; fy<=rect.top-0.5f; fy+=1.0f) | 1486 for (FX_FLOAT fy=rect.bottom+0.5f; fy<=rect.top-0.5f; fy+=1.0f) |
1487 { | 1487 { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1631 } | 1631 } |
1632 } | 1632 } |
1633 | 1633 |
1634 static void AddSpellCheckObj(CFX_PathData & PathData, IFX_Edit* pEdit, const CPV
T_WordRange& wrWord) | 1634 static void AddSpellCheckObj(CFX_PathData & PathData, IFX_Edit* pEdit, const CPV
T_WordRange& wrWord) |
1635 { | 1635 { |
1636 FX_FLOAT fStartX = 0.0f; | 1636 FX_FLOAT fStartX = 0.0f; |
1637 FX_FLOAT fEndX = 0.0f; | 1637 FX_FLOAT fEndX = 0.0f; |
1638 FX_FLOAT fY = 0.0f; | 1638 FX_FLOAT fY = 0.0f; |
1639 FX_FLOAT fStep = 0.0f; | 1639 FX_FLOAT fStep = 0.0f; |
1640 | 1640 |
1641 » FX_BOOL bBreak = FALSE; | 1641 » bool bBreak = false; |
1642 | 1642 |
1643 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) | 1643 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) |
1644 { | 1644 { |
1645 pIterator->SetAt(wrWord.BeginPos); | 1645 pIterator->SetAt(wrWord.BeginPos); |
1646 | 1646 |
1647 do | 1647 do |
1648 { | 1648 { |
1649 CPVT_WordPlace place = pIterator->GetAt(); | 1649 CPVT_WordPlace place = pIterator->GetAt(); |
1650 | 1650 |
1651 CPVT_Line line; | 1651 CPVT_Line line; |
(...skipping 19 matching lines...) Expand all Loading... |
1671 | 1671 |
1672 if (place.LineCmp(wrWord.EndPos) == 0) | 1672 if (place.LineCmp(wrWord.EndPos) == 0) |
1673 { | 1673 { |
1674 pIterator->SetAt(wrWord.EndPos); | 1674 pIterator->SetAt(wrWord.EndPos); |
1675 CPVT_Word word; | 1675 CPVT_Word word; |
1676 if (pIterator->GetWord(word)) | 1676 if (pIterator->GetWord(word)) |
1677 { | 1677 { |
1678 fEndX = word.ptWord.x + word.fWidth; | 1678 fEndX = word.ptWord.x + word.fWidth; |
1679 } | 1679 } |
1680 | 1680 |
1681 » » » » bBreak = TRUE; | 1681 » » » » bBreak = true; |
1682 } | 1682 } |
1683 else | 1683 else |
1684 { | 1684 { |
1685 fEndX = line.ptLine.x + line.fLineWidth; | 1685 fEndX = line.ptLine.x + line.fLineWidth; |
1686 } | 1686 } |
1687 | 1687 |
1688 AddSquigglyPath(PathData, fStartX, fEndX, fY, fStep); | 1688 AddSquigglyPath(PathData, fStartX, fEndX, fY, fStep); |
1689 | 1689 |
1690 if (bBreak) break; | 1690 if (bBreak) break; |
1691 } | 1691 } |
1692 while (pIterator->NextLine()); | 1692 while (pIterator->NextLine()); |
1693 } | 1693 } |
1694 } | 1694 } |
1695 | 1695 |
1696 void CPWL_Utils::DrawEditSpellCheck(CFX_RenderDevice* pDevice, CPDF_Matrix* pUse
r2Device, IFX_Edit* pEdit, | 1696 void CPWL_Utils::DrawEditSpellCheck(CFX_RenderDevice* pDevice, CPDF_Matrix* pUse
r2Device, IFX_Edit* pEdit, |
1697 const CPDF_Rect& rcClip, const C
PDF_Point& ptOffset, const CPVT_WordRange* pRange, | 1697 const CPDF_Rect& rcClip, const C
PDF_Point& ptOffset, const CPVT_WordRange* pRange, |
1698 IPWL_SpellCheck * pSpellCheck) | 1698 IPWL_SpellCheck * pSpellCheck) |
1699 { | 1699 { |
1700 const FX_COLORREF crSpell = ArgbEncode(255,255,0,0); | 1700 const FX_COLORREF crSpell = ArgbEncode(255,255,0,0); |
1701 | 1701 |
1702 //for spellcheck | 1702 //for spellcheck |
1703 » FX_BOOL bLatinWord = FALSE; | 1703 » bool bLatinWord = false; |
1704 CPVT_WordPlace wpWordStart; | 1704 CPVT_WordPlace wpWordStart; |
1705 CFX_ByteString sLatinWord; | 1705 CFX_ByteString sLatinWord; |
1706 | 1706 |
1707 CFX_PathData pathSpell; | 1707 CFX_PathData pathSpell; |
1708 | 1708 |
1709 pDevice->SaveState(); | 1709 pDevice->SaveState(); |
1710 | 1710 |
1711 if (!rcClip.IsEmpty()) | 1711 if (!rcClip.IsEmpty()) |
1712 { | 1712 { |
1713 CPDF_Rect rcTemp = rcClip; | 1713 CPDF_Rect rcTemp = rcClip; |
(...skipping 23 matching lines...) Expand all Loading... |
1737 if (pRange && place.WordCmp(pRange->EndPos) > 0)
break; | 1737 if (pRange && place.WordCmp(pRange->EndPos) > 0)
break; |
1738 | 1738 |
1739 CPVT_Word word; | 1739 CPVT_Word word; |
1740 if (pIterator->GetWord(word)) | 1740 if (pIterator->GetWord(word)) |
1741 { | 1741 { |
1742 if (FX_EDIT_ISLATINWORD(word.Word)) | 1742 if (FX_EDIT_ISLATINWORD(word.Word)) |
1743 { | 1743 { |
1744 if (!bLatinWord) | 1744 if (!bLatinWord) |
1745 { | 1745 { |
1746 wpWordStart = place; | 1746 wpWordStart = place; |
1747 » » » » » » » bLatinWord = TRUE; | 1747 » » » » » » » bLatinWord = true; |
1748 } | 1748 } |
1749 | 1749 |
1750 sLatinWord += (char)word.Word; | 1750 sLatinWord += (char)word.Word; |
1751 } | 1751 } |
1752 else | 1752 else |
1753 { | 1753 { |
1754 if (bLatinWord) | 1754 if (bLatinWord) |
1755 { | 1755 { |
1756 if (!sLatinWord.IsEmpty(
)) | 1756 if (!sLatinWord.IsEmpty(
)) |
1757 { | 1757 { |
1758 if (pSpellCheck
&& !pSpellCheck->CheckWord(sLatinWord)) | 1758 if (pSpellCheck
&& !pSpellCheck->CheckWord(sLatinWord)) |
1759 { | 1759 { |
1760 AddSpell
CheckObj(pathSpell,pEdit,CPVT_WordRange(wpWordStart,oldplace)); | 1760 AddSpell
CheckObj(pathSpell,pEdit,CPVT_WordRange(wpWordStart,oldplace)); |
1761 pIterato
r->SetAt(place); | 1761 pIterato
r->SetAt(place); |
1762 } | 1762 } |
1763 } | 1763 } |
1764 » » » » » » » bLatinWord = FALSE; | 1764 » » » » » » » bLatinWord = false; |
1765 } | 1765 } |
1766 | 1766 |
1767 sLatinWord.Empty(); | 1767 sLatinWord.Empty(); |
1768 } | 1768 } |
1769 | 1769 |
1770 oldplace = place; | 1770 oldplace = place; |
1771 } | 1771 } |
1772 else | 1772 else |
1773 { | 1773 { |
1774 if (bLatinWord) | 1774 if (bLatinWord) |
1775 { | 1775 { |
1776 if (!sLatinWord.IsEmpty()) | 1776 if (!sLatinWord.IsEmpty()) |
1777 { | 1777 { |
1778 if (pSpellCheck && !pSpe
llCheck->CheckWord(sLatinWord)) | 1778 if (pSpellCheck && !pSpe
llCheck->CheckWord(sLatinWord)) |
1779 { | 1779 { |
1780 AddSpellCheckObj
(pathSpell,pEdit,CPVT_WordRange(wpWordStart,oldplace)); | 1780 AddSpellCheckObj
(pathSpell,pEdit,CPVT_WordRange(wpWordStart,oldplace)); |
1781 pIterator->SetAt
(place); | 1781 pIterator->SetAt
(place); |
1782 } | 1782 } |
1783 } | 1783 } |
1784 » » » » » » bLatinWord = FALSE; | 1784 » » » » » » bLatinWord = false; |
1785 } | 1785 } |
1786 | 1786 |
1787 sLatinWord.Empty(); | 1787 sLatinWord.Empty(); |
1788 } | 1788 } |
1789 } | 1789 } |
1790 | 1790 |
1791 if (!sLatinWord.IsEmpty()) | 1791 if (!sLatinWord.IsEmpty()) |
1792 { | 1792 { |
1793 if (pSpellCheck && !pSpellCheck->CheckWord(sLati
nWord)) | 1793 if (pSpellCheck && !pSpellCheck->CheckWord(sLati
nWord)) |
1794 { | 1794 { |
1795 AddSpellCheckObj(pathSpell,pEdit,CPVT_Wo
rdRange(wpWordStart,oldplace)); | 1795 AddSpellCheckObj(pathSpell,pEdit,CPVT_Wo
rdRange(wpWordStart,oldplace)); |
1796 } | 1796 } |
1797 } | 1797 } |
1798 } | 1798 } |
1799 } | 1799 } |
1800 | 1800 |
1801 CFX_GraphStateData gsd; | 1801 CFX_GraphStateData gsd; |
1802 gsd.m_LineWidth = 0; | 1802 gsd.m_LineWidth = 0; |
1803 if (pathSpell.GetPointCount() > 0) | 1803 if (pathSpell.GetPointCount() > 0) |
1804 pDevice->DrawPath(&pathSpell, pUser2Device, &gsd, 0, crSpell, FX
FILL_ALTERNATE); | 1804 pDevice->DrawPath(&pathSpell, pUser2Device, &gsd, 0, crSpell, FX
FILL_ALTERNATE); |
1805 | 1805 |
1806 pDevice->RestoreState(); | 1806 pDevice->RestoreState(); |
1807 } | 1807 } |
1808 | 1808 |
1809 FX_BOOL CPWL_Utils::IsBlackOrWhite(const CPWL_Color& color) | 1809 bool CPWL_Utils::IsBlackOrWhite(const CPWL_Color& color) |
1810 { | 1810 { |
1811 switch (color.nColorType) | 1811 switch (color.nColorType) |
1812 { | 1812 { |
1813 case COLORTYPE_TRANSPARENT: | 1813 case COLORTYPE_TRANSPARENT: |
1814 » » return FALSE; | 1814 » » return false; |
1815 case COLORTYPE_GRAY: | 1815 case COLORTYPE_GRAY: |
1816 return color.fColor1 < 0.5f; | 1816 return color.fColor1 < 0.5f; |
1817 case COLORTYPE_RGB: | 1817 case COLORTYPE_RGB: |
1818 return color.fColor1 + color.fColor2 + color.fColor3 < 1.5f; | 1818 return color.fColor1 + color.fColor2 + color.fColor3 < 1.5f; |
1819 case COLORTYPE_CMYK: | 1819 case COLORTYPE_CMYK: |
1820 return color.fColor1 + color.fColor2 + color.fColor3 + color.fCo
lor4 > 2.0f; | 1820 return color.fColor1 + color.fColor2 + color.fColor3 + color.fCo
lor4 > 2.0f; |
1821 } | 1821 } |
1822 | 1822 |
1823 » return TRUE; | 1823 » return true; |
1824 } | 1824 } |
1825 | 1825 |
1826 CPWL_Color CPWL_Utils::GetReverseColor(const CPWL_Color& color) | 1826 CPWL_Color CPWL_Utils::GetReverseColor(const CPWL_Color& color) |
1827 { | 1827 { |
1828 CPWL_Color crRet = color; | 1828 CPWL_Color crRet = color; |
1829 | 1829 |
1830 switch (color.nColorType) | 1830 switch (color.nColorType) |
1831 { | 1831 { |
1832 case COLORTYPE_GRAY: | 1832 case COLORTYPE_GRAY: |
1833 crRet.fColor1 = 1.0f - crRet.fColor1; | 1833 crRet.fColor1 = 1.0f - crRet.fColor1; |
(...skipping 10 matching lines...) Expand all Loading... |
1844 crRet.fColor4 = 1.0f - crRet.fColor4; | 1844 crRet.fColor4 = 1.0f - crRet.fColor4; |
1845 break; | 1845 break; |
1846 } | 1846 } |
1847 | 1847 |
1848 return crRet; | 1848 return crRet; |
1849 } | 1849 } |
1850 | 1850 |
1851 CFX_ByteString CPWL_Utils::GetIconAppStream(int32_t nType, const CPDF_Rect& rect
, const CPWL_Color& crFill, | 1851 CFX_ByteString CPWL_Utils::GetIconAppStream(int32_t nType, const CPDF_Rect& rect
, const CPWL_Color& crFill, |
1852
const CPWL_Color& crStroke) | 1852
const CPWL_Color& crStroke) |
1853 { | 1853 { |
1854 » CFX_ByteString sAppStream = CPWL_Utils::GetColorAppStream(crStroke, FALS
E); | 1854 » CFX_ByteString sAppStream = CPWL_Utils::GetColorAppStream(crStroke, fals
e); |
1855 » sAppStream += CPWL_Utils::GetColorAppStream(crFill, TRUE); | 1855 » sAppStream += CPWL_Utils::GetColorAppStream(crFill, true); |
1856 | 1856 |
1857 CFX_ByteString sPath; | 1857 CFX_ByteString sPath; |
1858 CFX_PathData path; | 1858 CFX_PathData path; |
1859 | 1859 |
1860 switch (nType) | 1860 switch (nType) |
1861 { | 1861 { |
1862 case PWL_ICONTYPE_CHECKMARK: | 1862 case PWL_ICONTYPE_CHECKMARK: |
1863 GetGraphics_Checkmark(sPath, path, rect, PWLPT_STREAM); | 1863 GetGraphics_Checkmark(sPath, path, rect, PWLPT_STREAM); |
1864 break; | 1864 break; |
1865 case PWL_ICONTYPE_CIRCLE: | 1865 case PWL_ICONTYPE_CIRCLE: |
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2818 case COLORTYPE_RGB: | 2818 case COLORTYPE_RGB: |
2819 CPWL_Utils::ConvertCMYK2RGB(fColor1, fColor2, fColor3, f
Color4, fColor1, fColor2, fColor3); | 2819 CPWL_Utils::ConvertCMYK2RGB(fColor1, fColor2, fColor3, f
Color4, fColor1, fColor2, fColor3); |
2820 break; | 2820 break; |
2821 } | 2821 } |
2822 break; | 2822 break; |
2823 } | 2823 } |
2824 nColorType = other_nColorType; | 2824 nColorType = other_nColorType; |
2825 } | 2825 } |
2826 | 2826 |
2827 | 2827 |
OLD | NEW |