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

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

Issue 1751753002: Remove implicit conversions and some cleanup (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: address comments Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/src/fsdk_actionhandler.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 <algorithm> 7 #include <algorithm>
8 8
9 #include "core/include/fxcrt/fx_ext.h" 9 #include "core/include/fxcrt/fx_ext.h"
10 #include "fpdfsdk/include/fsdk_baseannot.h" 10 #include "fpdfsdk/include/fsdk_baseannot.h"
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 int nFlags = GetFlags(); 885 int nFlags = GetFlags();
886 return !((nFlags & ANNOTFLAG_INVISIBLE) || (nFlags & ANNOTFLAG_HIDDEN) || 886 return !((nFlags & ANNOTFLAG_INVISIBLE) || (nFlags & ANNOTFLAG_HIDDEN) ||
887 (nFlags & ANNOTFLAG_NOVIEW)); 887 (nFlags & ANNOTFLAG_NOVIEW));
888 } 888 }
889 889
890 CPDF_Action CPDFSDK_BAAnnot::GetAction() const { 890 CPDF_Action CPDFSDK_BAAnnot::GetAction() const {
891 return CPDF_Action(m_pAnnot->GetAnnotDict()->GetDictBy("A")); 891 return CPDF_Action(m_pAnnot->GetAnnotDict()->GetDictBy("A"));
892 } 892 }
893 893
894 void CPDFSDK_BAAnnot::SetAction(const CPDF_Action& action) { 894 void CPDFSDK_BAAnnot::SetAction(const CPDF_Action& action) {
895 ASSERT(action); 895 ASSERT(action.GetDict());
896 if ((CPDF_Action&)action != 896 if (action.GetDict() != m_pAnnot->GetAnnotDict()->GetDictBy("A")) {
897 CPDF_Action(m_pAnnot->GetAnnotDict()->GetDictBy("A"))) {
898 CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); 897 CPDF_Document* pDoc = m_pPageView->GetPDFDocument();
899 CPDF_Dictionary* pDict = action.GetDict(); 898 CPDF_Dictionary* pDict = action.GetDict();
900 if (pDict && pDict->GetObjNum() == 0) { 899 if (pDict && pDict->GetObjNum() == 0) {
901 pDoc->AddIndirectObject(pDict); 900 pDoc->AddIndirectObject(pDict);
902 } 901 }
903 m_pAnnot->GetAnnotDict()->SetAtReference("A", pDoc, pDict->GetObjNum()); 902 m_pAnnot->GetAnnotDict()->SetAtReference("A", pDoc, pDict->GetObjNum());
904 } 903 }
905 } 904 }
906 905
907 void CPDFSDK_BAAnnot::RemoveAction() { 906 void CPDFSDK_BAAnnot::RemoveAction() {
908 m_pAnnot->GetAnnotDict()->RemoveAt("A"); 907 m_pAnnot->GetAnnotDict()->RemoveAt("A");
909 } 908 }
910 909
911 CPDF_AAction CPDFSDK_BAAnnot::GetAAction() const { 910 CPDF_AAction CPDFSDK_BAAnnot::GetAAction() const {
912 return m_pAnnot->GetAnnotDict()->GetDictBy("AA"); 911 return CPDF_AAction(m_pAnnot->GetAnnotDict()->GetDictBy("AA"));
913 } 912 }
914 913
915 void CPDFSDK_BAAnnot::SetAAction(const CPDF_AAction& aa) { 914 void CPDFSDK_BAAnnot::SetAAction(const CPDF_AAction& aa) {
916 if ((CPDF_AAction&)aa != m_pAnnot->GetAnnotDict()->GetDictBy("AA")) 915 if (aa.GetDict() != m_pAnnot->GetAnnotDict()->GetDictBy("AA"))
917 m_pAnnot->GetAnnotDict()->SetAt("AA", (CPDF_AAction&)aa); 916 m_pAnnot->GetAnnotDict()->SetAt("AA", aa.GetDict());
918 } 917 }
919 918
920 void CPDFSDK_BAAnnot::RemoveAAction() { 919 void CPDFSDK_BAAnnot::RemoveAAction() {
921 m_pAnnot->GetAnnotDict()->RemoveAt("AA"); 920 m_pAnnot->GetAnnotDict()->RemoveAt("AA");
922 } 921 }
923 922
924 CPDF_Action CPDFSDK_BAAnnot::GetAAction(CPDF_AAction::AActionType eAAT) { 923 CPDF_Action CPDFSDK_BAAnnot::GetAAction(CPDF_AAction::AActionType eAAT) {
925 CPDF_AAction AAction = GetAAction(); 924 CPDF_AAction AAction = GetAAction();
926 925
927 if (AAction.ActionExist(eAAT)) 926 if (AAction.ActionExist(eAAT))
(...skipping 29 matching lines...) Expand all
957 956
958 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { 957 CPDF_Page* CPDFSDK_Annot::GetPDFPage() {
959 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr; 958 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr;
960 } 959 }
961 960
962 #ifdef PDF_ENABLE_XFA 961 #ifdef PDF_ENABLE_XFA
963 CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() { 962 CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() {
964 return m_pPageView ? m_pPageView->GetPDFXFAPage() : nullptr; 963 return m_pPageView ? m_pPageView->GetPDFXFAPage() : nullptr;
965 } 964 }
966 #endif // PDF_ENABLE_XFA 965 #endif // PDF_ENABLE_XFA
OLDNEW
« no previous file with comments | « fpdfsdk/src/fsdk_actionhandler.cpp ('k') | fpdfsdk/src/fsdk_baseform.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698