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

Side by Side Diff: fpdfsdk/src/fsdk_baseannot.cpp

Issue 1512763013: Get rid of most instance of 'foo != NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: nits Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/src/fsdk_annothandler.cpp ('k') | fpdfsdk/src/fsdk_baseform.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "core/include/fxcrt/fx_ext.h" 7 #include "core/include/fxcrt/fx_ext.h"
8 #include "fpdfsdk/include/fsdk_baseannot.h" 8 #include "fpdfsdk/include/fsdk_baseannot.h"
9 #include "fpdfsdk/include/fsdk_define.h" 9 #include "fpdfsdk/include/fsdk_define.h"
10 #include "fpdfsdk/include/fsdk_mgr.h" 10 #include "fpdfsdk/include/fsdk_mgr.h"
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 // Tab Order 521 // Tab Order
522 int CPDFSDK_Annot::GetTabOrder() { 522 int CPDFSDK_Annot::GetTabOrder() {
523 return m_nTabOrder; 523 return m_nTabOrder;
524 } 524 }
525 525
526 void CPDFSDK_Annot::SetTabOrder(int iTabOrder) { 526 void CPDFSDK_Annot::SetTabOrder(int iTabOrder) {
527 m_nTabOrder = iTabOrder; 527 m_nTabOrder = iTabOrder;
528 } 528 }
529 529
530 CPDF_Dictionary* CPDFSDK_BAAnnot::GetAnnotDict() const { 530 CPDF_Dictionary* CPDFSDK_BAAnnot::GetAnnotDict() const {
531 ASSERT(m_pAnnot != NULL);
532
533 return m_pAnnot->GetAnnotDict(); 531 return m_pAnnot->GetAnnotDict();
534 } 532 }
535 533
536 void CPDFSDK_BAAnnot::SetRect(const CPDF_Rect& rect) { 534 void CPDFSDK_BAAnnot::SetRect(const CPDF_Rect& rect) {
537 ASSERT(rect.right - rect.left >= GetMinWidth()); 535 ASSERT(rect.right - rect.left >= GetMinWidth());
538 ASSERT(rect.top - rect.bottom >= GetMinHeight()); 536 ASSERT(rect.top - rect.bottom >= GetMinHeight());
539 537
540 m_pAnnot->GetAnnotDict()->SetAtRect("Rect", rect); 538 m_pAnnot->GetAnnotDict()->SetAtRect("Rect", rect);
541 } 539 }
542 540
543 CPDF_Rect CPDFSDK_BAAnnot::GetRect() const { 541 CPDF_Rect CPDFSDK_BAAnnot::GetRect() const {
544 ASSERT(m_pAnnot != NULL);
545
546 CPDF_Rect rect; 542 CPDF_Rect rect;
547 m_pAnnot->GetRect(rect); 543 m_pAnnot->GetRect(rect);
548
549 return rect; 544 return rect;
550 } 545 }
551 546
552 CFX_ByteString CPDFSDK_BAAnnot::GetType() const { 547 CFX_ByteString CPDFSDK_BAAnnot::GetType() const {
553 ASSERT(m_pAnnot != NULL);
554
555 return m_pAnnot->GetSubType(); 548 return m_pAnnot->GetSubType();
556 } 549 }
557 550
558 CFX_ByteString CPDFSDK_BAAnnot::GetSubType() const { 551 CFX_ByteString CPDFSDK_BAAnnot::GetSubType() const {
559 return ""; 552 return "";
560 } 553 }
561 554
562 void CPDFSDK_BAAnnot::DrawAppearance(CFX_RenderDevice* pDevice, 555 void CPDFSDK_BAAnnot::DrawAppearance(CFX_RenderDevice* pDevice,
563 const CFX_Matrix* pUser2Device, 556 const CFX_Matrix* pUser2Device,
564 CPDF_Annot::AppearanceMode mode, 557 CPDF_Annot::AppearanceMode mode,
565 const CPDF_RenderOptions* pOptions) { 558 const CPDF_RenderOptions* pOptions) {
566 ASSERT(m_pPageView != NULL);
567 ASSERT(m_pAnnot != NULL);
568
569 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, 559 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device,
570 mode, pOptions); 560 mode, pOptions);
571 } 561 }
572 562
573 FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid() { 563 FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid() {
574 return m_pAnnot->GetAnnotDict()->GetDict("AP") != NULL; 564 return m_pAnnot->GetAnnotDict()->GetDict("AP") != NULL;
575 } 565 }
576 566
577 FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) { 567 FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) {
578 CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDict("AP"); 568 CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDict("AP");
(...skipping 13 matching lines...) Expand all
592 CPDF_Object* psub = pAP->GetElementValue(ap_entry); 582 CPDF_Object* psub = pAP->GetElementValue(ap_entry);
593 if (psub == NULL) 583 if (psub == NULL)
594 return FALSE; 584 return FALSE;
595 585
596 return TRUE; 586 return TRUE;
597 } 587 }
598 588
599 void CPDFSDK_BAAnnot::DrawBorder(CFX_RenderDevice* pDevice, 589 void CPDFSDK_BAAnnot::DrawBorder(CFX_RenderDevice* pDevice,
600 const CFX_Matrix* pUser2Device, 590 const CFX_Matrix* pUser2Device,
601 const CPDF_RenderOptions* pOptions) { 591 const CPDF_RenderOptions* pOptions) {
602 ASSERT(m_pAnnot != NULL);
603 m_pAnnot->DrawBorder(pDevice, pUser2Device, pOptions); 592 m_pAnnot->DrawBorder(pDevice, pUser2Device, pOptions);
604 } 593 }
605 594
606 void CPDFSDK_BAAnnot::ClearCachedAP() { 595 void CPDFSDK_BAAnnot::ClearCachedAP() {
607 ASSERT(m_pAnnot != NULL);
608 m_pAnnot->ClearCachedAP(); 596 m_pAnnot->ClearCachedAP();
609 } 597 }
610 598
611 void CPDFSDK_BAAnnot::SetContents(const CFX_WideString& sContents) { 599 void CPDFSDK_BAAnnot::SetContents(const CFX_WideString& sContents) {
612 if (sContents.IsEmpty()) 600 if (sContents.IsEmpty())
613 m_pAnnot->GetAnnotDict()->RemoveAt("Contents"); 601 m_pAnnot->GetAnnotDict()->RemoveAt("Contents");
614 else 602 else
615 m_pAnnot->GetAnnotDict()->SetAtString("Contents", 603 m_pAnnot->GetAnnotDict()->SetAtString("Contents",
616 PDF_EncodeText(sContents)); 604 PDF_EncodeText(sContents));
617 } 605 }
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 925
938 void CPDFSDK_BAAnnot::RemoveAction() { 926 void CPDFSDK_BAAnnot::RemoveAction() {
939 m_pAnnot->GetAnnotDict()->RemoveAt("A"); 927 m_pAnnot->GetAnnotDict()->RemoveAt("A");
940 } 928 }
941 929
942 CPDF_AAction CPDFSDK_BAAnnot::GetAAction() const { 930 CPDF_AAction CPDFSDK_BAAnnot::GetAAction() const {
943 return m_pAnnot->GetAnnotDict()->GetDict("AA"); 931 return m_pAnnot->GetAnnotDict()->GetDict("AA");
944 } 932 }
945 933
946 void CPDFSDK_BAAnnot::SetAAction(const CPDF_AAction& aa) { 934 void CPDFSDK_BAAnnot::SetAAction(const CPDF_AAction& aa) {
947 ASSERT(aa != NULL);
948
949 if ((CPDF_AAction&)aa != m_pAnnot->GetAnnotDict()->GetDict("AA")) 935 if ((CPDF_AAction&)aa != m_pAnnot->GetAnnotDict()->GetDict("AA"))
950 m_pAnnot->GetAnnotDict()->SetAt("AA", (CPDF_AAction&)aa); 936 m_pAnnot->GetAnnotDict()->SetAt("AA", (CPDF_AAction&)aa);
951 } 937 }
952 938
953 void CPDFSDK_BAAnnot::RemoveAAction() { 939 void CPDFSDK_BAAnnot::RemoveAAction() {
954 m_pAnnot->GetAnnotDict()->RemoveAt("AA"); 940 m_pAnnot->GetAnnotDict()->RemoveAt("AA");
955 } 941 }
956 942
957 CPDF_Action CPDFSDK_BAAnnot::GetAAction(CPDF_AAction::AActionType eAAT) { 943 CPDF_Action CPDFSDK_BAAnnot::GetAAction(CPDF_AAction::AActionType eAAT) {
958 CPDF_AAction AAction = GetAAction(); 944 CPDF_AAction AAction = GetAAction();
(...skipping 19 matching lines...) Expand all
978 964
979 UnderlyingPageType* CPDFSDK_Annot::GetUnderlyingPage() { 965 UnderlyingPageType* CPDFSDK_Annot::GetUnderlyingPage() {
980 return GetPDFPage(); 966 return GetPDFPage();
981 } 967 }
982 968
983 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { 969 CPDF_Page* CPDFSDK_Annot::GetPDFPage() {
984 if (m_pPageView) 970 if (m_pPageView)
985 return m_pPageView->GetPDFPage(); 971 return m_pPageView->GetPDFPage();
986 return NULL; 972 return NULL;
987 } 973 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/fsdk_annothandler.cpp ('k') | fpdfsdk/src/fsdk_baseform.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698