summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfdoc/cpdf_formcontrol.cpp10
-rw-r--r--core/fpdfdoc/cpdf_formcontrol.h8
-rw-r--r--core/fpdfdoc/cpdf_formfield.cpp44
-rw-r--r--core/fpdfdoc/cpdf_interform.h7
4 files changed, 35 insertions, 34 deletions
diff --git a/core/fpdfdoc/cpdf_formcontrol.cpp b/core/fpdfdoc/cpdf_formcontrol.cpp
index 62302fe499..7d4067b52f 100644
--- a/core/fpdfdoc/cpdf_formcontrol.cpp
+++ b/core/fpdfdoc/cpdf_formcontrol.cpp
@@ -180,8 +180,8 @@ void CPDF_FormControl::DrawControl(CFX_RenderDevice* pDevice,
CFX_Matrix matrix;
matrix.MatchRect(arect, form_bbox);
matrix.Concat(*pMatrix);
- CPDF_Form form(m_pField->GetForm()->m_pDocument.Get(),
- m_pField->GetForm()->m_pFormDict->GetDictFor("DR"), pStream);
+ CPDF_Form form(m_pField->GetForm()->GetDocument(),
+ m_pField->GetForm()->GetFormDict()->GetDictFor("DR"), pStream);
form.ParseContent();
CPDF_RenderContext context(pPage);
context.AppendLayer(&form, &matrix);
@@ -292,7 +292,8 @@ CPDF_Font* CPDF_FormControl::GetDefaultControlFont() {
if (pFonts) {
CPDF_Dictionary* pElement = pFonts->GetDictFor(csFontNameTag);
if (pElement) {
- CPDF_Font* pFont = m_pField->GetForm()->m_pDocument->LoadFont(pElement);
+ CPDF_Font* pFont =
+ m_pField->GetForm()->GetDocument()->LoadFont(pElement);
if (pFont)
return pFont;
}
@@ -308,7 +309,8 @@ CPDF_Font* CPDF_FormControl::GetDefaultControlFont() {
if (pFonts) {
CPDF_Dictionary* pElement = pFonts->GetDictFor(csFontNameTag);
if (pElement) {
- CPDF_Font* pFont = m_pField->GetForm()->m_pDocument->LoadFont(pElement);
+ CPDF_Font* pFont =
+ m_pField->GetForm()->GetDocument()->LoadFont(pElement);
if (pFont)
return pFont;
}
diff --git a/core/fpdfdoc/cpdf_formcontrol.h b/core/fpdfdoc/cpdf_formcontrol.h
index 37b3d255e2..b22b074600 100644
--- a/core/fpdfdoc/cpdf_formcontrol.h
+++ b/core/fpdfdoc/cpdf_formcontrol.h
@@ -110,13 +110,11 @@ class CPDF_FormControl {
CPDF_Font* GetDefaultControlFont();
int GetControlAlignment();
- private:
- friend class CPDF_InterForm;
- friend class CPDF_FormField;
-
ByteString GetOnStateName() const;
- void SetOnStateName(const ByteString& csOn);
void CheckControl(bool bChecked);
+
+ private:
+ void SetOnStateName(const ByteString& csOn);
FX_ARGB GetColor(int& iColorType, const ByteString& csEntry);
float GetOriginalColor(int index, const ByteString& csEntry);
void GetOriginalColor(int& iColorType,
diff --git a/core/fpdfdoc/cpdf_formfield.cpp b/core/fpdfdoc/cpdf_formfield.cpp
index fec1945956..637cb9eece 100644
--- a/core/fpdfdoc/cpdf_formfield.cpp
+++ b/core/fpdfdoc/cpdf_formfield.cpp
@@ -174,8 +174,8 @@ bool CPDF_FormField::ResetField(bool bNotify) {
CheckControl(i, GetControl(i)->IsDefaultChecked(), false);
}
}
- if (bNotify && m_pForm->m_pFormNotify)
- m_pForm->m_pFormNotify->AfterCheckedStatusChange(this);
+ if (bNotify && m_pForm->GetFormNotify())
+ m_pForm->GetFormNotify()->AfterCheckedStatusChange(this);
break;
}
case CPDF_FormField::ComboBox:
@@ -408,7 +408,7 @@ int CPDF_FormField::GetMaxLen() const {
for (auto& pControl : m_ControlList) {
if (!pControl)
continue;
- CPDF_Dictionary* pWidgetDict = pControl->m_pWidgetDict.Get();
+ CPDF_Dictionary* pWidgetDict = pControl->GetWidget();
if (pWidgetDict->KeyExist("MaxLen"))
return pWidgetDict->GetIntegerFor("MaxLen");
}
@@ -467,7 +467,7 @@ int CPDF_FormField::GetSelectedIndex(int index) const {
}
bool CPDF_FormField::ClearSelection(bool bNotify) {
- if (bNotify && m_pForm->m_pFormNotify) {
+ if (bNotify && m_pForm->GetFormNotify()) {
WideString csValue;
int iIndex = GetSelectedIndex(0);
if (iIndex >= 0)
@@ -680,7 +680,7 @@ int CPDF_FormField::InsertOption(WideString csOptLabel,
}
bool CPDF_FormField::ClearOptions(bool bNotify) {
- if (bNotify && m_pForm->m_pFormNotify) {
+ if (bNotify && m_pForm->GetFormNotify()) {
WideString csValue;
int iIndex = GetSelectedIndex(0);
if (iIndex >= 0)
@@ -753,8 +753,8 @@ bool CPDF_FormField::CheckControl(int iControlIndex,
csIndex.Format("%d", iControlIndex);
m_pDict->SetNewFor<CPDF_Name>("V", csIndex);
}
- if (bNotify && m_pForm->m_pFormNotify)
- m_pForm->m_pFormNotify->AfterCheckedStatusChange(this);
+ if (bNotify && m_pForm->GetFormNotify())
+ m_pForm->GetFormNotify()->AfterCheckedStatusChange(this);
return true;
}
@@ -788,8 +788,8 @@ bool CPDF_FormField::SetCheckValue(const WideString& value,
if (val)
break;
}
- if (bNotify && m_pForm->m_pFormNotify)
- m_pForm->m_pFormNotify->AfterCheckedStatusChange(this);
+ if (bNotify && m_pForm->GetFormNotify())
+ m_pForm->GetFormNotify()->AfterCheckedStatusChange(this);
return true;
}
@@ -842,7 +842,7 @@ bool CPDF_FormField::SelectOption(int iOptIndex, bool bSelected, bool bNotify) {
if (bSelected)
return true;
- if (bNotify && m_pForm->m_pFormNotify) {
+ if (bNotify && m_pForm->GetFormNotify()) {
WideString csValue = GetOptionLabel(iOptIndex);
if (!NotifyListOrComboBoxBeforeChange(csValue))
return false;
@@ -856,7 +856,7 @@ bool CPDF_FormField::SelectOption(int iOptIndex, bool bSelected, bool bNotify) {
if (!bSelected)
continue;
- if (bNotify && m_pForm->m_pFormNotify) {
+ if (bNotify && m_pForm->GetFormNotify()) {
WideString csValue = GetOptionLabel(iOptIndex);
if (!NotifyListOrComboBoxBeforeChange(csValue))
return false;
@@ -880,7 +880,7 @@ bool CPDF_FormField::SelectOption(int iOptIndex, bool bSelected, bool bNotify) {
}
bool CPDF_FormField::ClearSelectedOptions(bool bNotify) {
- if (bNotify && m_pForm->m_pFormNotify) {
+ if (bNotify && m_pForm->GetFormNotify()) {
WideString csValue;
int iIndex = GetSelectedIndex(0);
if (iIndex >= 0)
@@ -897,7 +897,7 @@ bool CPDF_FormField::ClearSelectedOptions(bool bNotify) {
}
void CPDF_FormField::LoadDA() {
- CPDF_Dictionary* pFormDict = m_pForm->m_pFormDict.Get();
+ CPDF_Dictionary* pFormDict = m_pForm->GetFormDict();
if (!pFormDict)
return;
@@ -926,32 +926,32 @@ void CPDF_FormField::LoadDA() {
if (!pFontDict)
return;
- m_pFont = m_pForm->m_pDocument->LoadFont(pFontDict);
+ m_pFont = m_pForm->GetDocument()->LoadFont(pFontDict);
m_FontSize = FX_atof(syntax.GetWord());
}
bool CPDF_FormField::NotifyBeforeSelectionChange(const WideString& value) {
- if (!m_pForm->m_pFormNotify)
+ if (!m_pForm->GetFormNotify())
return true;
- return m_pForm->m_pFormNotify->BeforeSelectionChange(this, value) >= 0;
+ return m_pForm->GetFormNotify()->BeforeSelectionChange(this, value) >= 0;
}
void CPDF_FormField::NotifyAfterSelectionChange() {
- if (!m_pForm->m_pFormNotify)
+ if (!m_pForm->GetFormNotify())
return;
- m_pForm->m_pFormNotify->AfterSelectionChange(this);
+ m_pForm->GetFormNotify()->AfterSelectionChange(this);
}
bool CPDF_FormField::NotifyBeforeValueChange(const WideString& value) {
- if (!m_pForm->m_pFormNotify)
+ if (!m_pForm->GetFormNotify())
return true;
- return m_pForm->m_pFormNotify->BeforeValueChange(this, value) >= 0;
+ return m_pForm->GetFormNotify()->BeforeValueChange(this, value) >= 0;
}
void CPDF_FormField::NotifyAfterValueChange() {
- if (!m_pForm->m_pFormNotify)
+ if (!m_pForm->GetFormNotify())
return;
- m_pForm->m_pFormNotify->AfterValueChange(this);
+ m_pForm->GetFormNotify()->AfterValueChange(this);
}
bool CPDF_FormField::NotifyListOrComboBoxBeforeChange(const WideString& value) {
diff --git a/core/fpdfdoc/cpdf_interform.h b/core/fpdfdoc/cpdf_interform.h
index 576c2ccc39..7e3fbef5f0 100644
--- a/core/fpdfdoc/cpdf_interform.h
+++ b/core/fpdfdoc/cpdf_interform.h
@@ -89,10 +89,11 @@ class CPDF_InterForm {
bool HasXFAForm() const;
void FixPageFields(const CPDF_Page* pPage);
- private:
- friend class CPDF_FormControl;
- friend class CPDF_FormField;
+ IPDF_FormNotify* GetFormNotify() const { return m_pFormNotify.Get(); }
+ CPDF_Document* GetDocument() const { return m_pDocument.Get(); }
+ CPDF_Dictionary* GetFormDict() const { return m_pFormDict.Get(); }
+ private:
void LoadField(CPDF_Dictionary* pFieldDict, int nLevel);
void AddTerminalField(CPDF_Dictionary* pFieldDict);
CPDF_FormControl* AddControl(CPDF_FormField* pField,