summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/cpdf_interform.cpp
diff options
context:
space:
mode:
authorNicolas Pena <npm@chromium.org>2017-04-19 17:38:54 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-04-20 00:35:01 +0000
commit03f0fb0e650f134f31991b62e39c4d9a9d577560 (patch)
tree83235fd1bfba082f92f4648bbe16e8f120c1f574 /core/fpdfdoc/cpdf_interform.cpp
parent7a68198438f41e19f21e06e0f3447e525d0b253b (diff)
downloadpdfium-03f0fb0e650f134f31991b62e39c4d9a9d577560.tar.xz
Remove the friends of CPDF_FormField
Added some public methods so that CPDF_FormField has no friends. Change-Id: I179537e3c6ea64cedaca5365010c34c1ad702c40 Reviewed-on: https://pdfium-review.googlesource.com/4370 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfdoc/cpdf_interform.cpp')
-rw-r--r--core/fpdfdoc/cpdf_interform.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/core/fpdfdoc/cpdf_interform.cpp b/core/fpdfdoc/cpdf_interform.cpp
index 23102a20ad..dad25aa037 100644
--- a/core/fpdfdoc/cpdf_interform.cpp
+++ b/core/fpdfdoc/cpdf_interform.cpp
@@ -948,13 +948,13 @@ int CPDF_InterForm::FindFieldInCalculationOrder(const CPDF_FormField* pField) {
for (size_t i = 0; i < pArray->GetCount(); i++) {
CPDF_Object* pElement = pArray->GetDirectObjectAt(i);
- if (pElement == pField->m_pDict)
+ if (pElement == pField->GetDict())
return i;
}
return -1;
}
-CPDF_Font* CPDF_InterForm::GetFormFont(CFX_ByteString csNameTag) {
+CPDF_Font* CPDF_InterForm::GetFormFont(CFX_ByteString csNameTag) const {
return GetFont(m_pFormDict, m_pDocument, csNameTag);
}
@@ -1133,7 +1133,7 @@ CPDF_FormControl* CPDF_InterForm::AddControl(CPDF_FormField* pField,
auto pNew = pdfium::MakeUnique<CPDF_FormControl>(pField, pWidgetDict);
CPDF_FormControl* pControl = pNew.get();
m_ControlMap[pWidgetDict] = std::move(pNew);
- pField->m_ControlList.push_back(pControl);
+ pField->AddFormControl(pControl);
return pControl;
}
@@ -1160,7 +1160,7 @@ bool CPDF_InterForm::CheckRequiredFields(
if (fields)
bFind = pdfium::ContainsValue(*fields, pField);
if (bIncludeOrExclude == bFind) {
- CPDF_Dictionary* pFieldDict = pField->m_pDict;
+ const CPDF_Dictionary* pFieldDict = pField->GetDict();
if ((dwFlags & FORMFLAG_REQUIRED) != 0 &&
pFieldDict->GetStringFor("V").IsEmpty()) {
return false;
@@ -1216,8 +1216,10 @@ std::unique_ptr<CFDF_Document> CPDF_InterForm::ExportToFDF(
continue;
if (bIncludeOrExclude == pdfium::ContainsValue(fields, pField)) {
- if ((dwFlags & 0x02) != 0 && pField->m_pDict->GetStringFor("V").IsEmpty())
+ if ((dwFlags & 0x02) != 0 &&
+ pField->GetDict()->GetStringFor("V").IsEmpty()) {
continue;
+ }
CFX_WideString fullname = FPDF_GetFullName(pField->GetFieldDict());
auto pFieldDict =
@@ -1227,13 +1229,13 @@ std::unique_ptr<CFDF_Document> CPDF_InterForm::ExportToFDF(
pField->GetType() == CPDF_FormField::RadioButton) {
CFX_WideString csExport = pField->GetCheckValue(false);
CFX_ByteString csBExport = PDF_EncodeText(csExport);
- CPDF_Object* pOpt = FPDF_GetFieldAttr(pField->m_pDict, "Opt");
+ CPDF_Object* pOpt = FPDF_GetFieldAttr(pField->GetDict(), "Opt");
if (pOpt)
pFieldDict->SetNewFor<CPDF_String>("V", csBExport, false);
else
pFieldDict->SetNewFor<CPDF_Name>("V", csBExport);
} else {
- CPDF_Object* pV = FPDF_GetFieldAttr(pField->m_pDict, "V");
+ CPDF_Object* pV = FPDF_GetFieldAttr(pField->GetDict(), "V");
if (pV)
pFieldDict->SetFor("V", pV->CloneDirectObject());
}
@@ -1285,8 +1287,7 @@ void CPDF_InterForm::FDF_ImportField(CPDF_Dictionary* pFieldDict,
CPDF_FormField::Type eType = pField->GetType();
if ((eType == CPDF_FormField::ListBox || eType == CPDF_FormField::ComboBox) &&
pFieldDict->KeyExist("Opt")) {
- pField->m_pDict->SetFor(
- "Opt", pFieldDict->GetDirectObjectFor("Opt")->CloneDirectObject());
+ pField->SetOpt(pFieldDict->GetDirectObjectFor("Opt")->CloneDirectObject());
}
if (bNotify && m_pFormNotify) {