summaryrefslogtreecommitdiff
path: root/core/fpdfdoc
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfdoc')
-rw-r--r--core/fpdfdoc/doc_form.cpp96
-rw-r--r--core/fpdfdoc/doc_formcontrol.cpp80
-rw-r--r--core/fpdfdoc/doc_formfield.cpp539
-rw-r--r--core/fpdfdoc/include/fpdf_doc.h65
4 files changed, 338 insertions, 442 deletions
diff --git a/core/fpdfdoc/doc_form.cpp b/core/fpdfdoc/doc_form.cpp
index 7c81f0ee6f..7357f0a2eb 100644
--- a/core/fpdfdoc/doc_form.cpp
+++ b/core/fpdfdoc/doc_form.cpp
@@ -260,14 +260,13 @@ CFieldTree::_Node* CFieldTree::FindNode(const CFX_WideString& full_name) {
}
return pNode;
}
-CPDF_InterForm::CPDF_InterForm(CPDF_Document* pDocument, FX_BOOL bGenerateAP)
+
+CPDF_InterForm::CPDF_InterForm(CPDF_Document* pDocument)
: CFX_PrivateData(),
m_pDocument(pDocument),
- m_bGenerateAP(bGenerateAP),
m_pFormDict(nullptr),
m_pFieldTree(new CFieldTree),
- m_pFormNotify(nullptr),
- m_bUpdated(FALSE) {
+ m_pFormNotify(nullptr) {
CPDF_Dictionary* pRoot = m_pDocument->GetRoot();
if (!pRoot)
return;
@@ -732,47 +731,38 @@ CPDF_FormControl* CPDF_InterForm::GetControlByDict(
return it != m_ControlMap.end() ? it->second : nullptr;
}
-FX_BOOL CPDF_InterForm::NeedConstructAP() {
+FX_BOOL CPDF_InterForm::NeedConstructAP() const {
return m_pFormDict && m_pFormDict->GetBooleanBy("NeedAppearances");
}
-void CPDF_InterForm::NeedConstructAP(FX_BOOL bNeedAP) {
- if (!m_pFormDict) {
- InitInterFormDict(m_pFormDict, m_pDocument);
- }
- m_pFormDict->SetAtBoolean("NeedAppearances", bNeedAP);
- m_bGenerateAP = bNeedAP;
-}
int CPDF_InterForm::CountFieldsInCalculationOrder() {
- if (!m_pFormDict) {
+ if (!m_pFormDict)
return 0;
- }
+
CPDF_Array* pArray = m_pFormDict->GetArrayBy("CO");
return pArray ? pArray->GetCount() : 0;
}
CPDF_FormField* CPDF_InterForm::GetFieldInCalculationOrder(int index) {
- if (!m_pFormDict || index < 0) {
- return NULL;
- }
+ if (!m_pFormDict || index < 0)
+ return nullptr;
+
CPDF_Array* pArray = m_pFormDict->GetArrayBy("CO");
- if (!pArray) {
- return NULL;
- }
- if (CPDF_Dictionary* pElement =
- ToDictionary(pArray->GetDirectObjectAt(index))) {
- return GetFieldByDict(pElement);
- }
- return NULL;
+ if (!pArray)
+ return nullptr;
+
+ CPDF_Dictionary* pElement = ToDictionary(pArray->GetDirectObjectAt(index));
+ return pElement ? GetFieldByDict(pElement) : nullptr;
}
+
int CPDF_InterForm::FindFieldInCalculationOrder(const CPDF_FormField* pField) {
- if (!m_pFormDict || !pField) {
+ if (!m_pFormDict || !pField)
return -1;
- }
+
CPDF_Array* pArray = m_pFormDict->GetArrayBy("CO");
- if (!pArray) {
+ if (!pArray)
return -1;
- }
+
for (size_t i = 0; i < pArray->GetCount(); i++) {
CPDF_Object* pElement = pArray->GetDirectObjectAt(i);
if (pElement == pField->m_pDict) {
@@ -781,9 +771,11 @@ int CPDF_InterForm::FindFieldInCalculationOrder(const CPDF_FormField* pField) {
}
return -1;
}
+
uint32_t CPDF_InterForm::CountFormFonts() {
return CountInterFormFonts(m_pFormDict);
}
+
CPDF_Font* CPDF_InterForm::GetFormFont(uint32_t index,
CFX_ByteString& csNameTag) {
return GetInterFormFont(m_pFormDict, m_pDocument, index, csNameTag);
@@ -815,23 +807,22 @@ FX_BOOL CPDF_InterForm::FindFormFont(CFX_ByteString csFontName,
void CPDF_InterForm::AddFormFont(const CPDF_Font* pFont,
CFX_ByteString& csNameTag) {
AddInterFormFont(m_pFormDict, m_pDocument, pFont, csNameTag);
- m_bUpdated = TRUE;
}
+
CPDF_Font* CPDF_InterForm::AddNativeFormFont(uint8_t charSet,
CFX_ByteString& csNameTag) {
- m_bUpdated = TRUE;
return AddNativeInterFormFont(m_pFormDict, m_pDocument, charSet, csNameTag);
}
+
CPDF_Font* CPDF_InterForm::AddNativeFormFont(CFX_ByteString& csNameTag) {
- m_bUpdated = TRUE;
return AddNativeInterFormFont(m_pFormDict, m_pDocument, csNameTag);
}
+
void CPDF_InterForm::RemoveFormFont(const CPDF_Font* pFont) {
- m_bUpdated = TRUE;
RemoveInterFormFont(m_pFormDict, pFont);
}
+
void CPDF_InterForm::RemoveFormFont(CFX_ByteString csNameTag) {
- m_bUpdated = TRUE;
RemoveInterFormFont(m_pFormDict, csNameTag);
}
@@ -1171,42 +1162,37 @@ void CPDF_InterForm::FDF_ImportField(CPDF_Dictionary* pFieldDict,
m_pFormNotify->AfterValueChange(pField);
}
}
- if (CPDF_InterForm::m_bUpdateAP) {
- pField->UpdateAP(NULL);
- }
}
+
FX_BOOL CPDF_InterForm::ImportFromFDF(const CFDF_Document* pFDF,
FX_BOOL bNotify) {
- if (!pFDF) {
+ if (!pFDF)
return FALSE;
- }
+
CPDF_Dictionary* pMainDict = pFDF->GetRoot()->GetDictBy("FDF");
- if (!pMainDict) {
+ if (!pMainDict)
return FALSE;
- }
+
CPDF_Array* pFields = pMainDict->GetArrayBy("Fields");
- if (!pFields) {
+ if (!pFields)
return FALSE;
- }
+
m_bsEncoding = pMainDict->GetStringBy("Encoding");
- if (bNotify && m_pFormNotify) {
- int iRet = m_pFormNotify->BeforeFormImportData(this);
- if (iRet < 0) {
- return FALSE;
- }
- }
+ if (bNotify && m_pFormNotify && m_pFormNotify->BeforeFormImportData(this) < 0)
+ return FALSE;
+
for (size_t i = 0; i < pFields->GetCount(); i++) {
CPDF_Dictionary* pField = pFields->GetDictAt(i);
- if (!pField) {
+ if (!pField)
continue;
- }
+
FDF_ImportField(pField, L"", bNotify);
}
- if (bNotify && m_pFormNotify) {
+ if (bNotify && m_pFormNotify)
m_pFormNotify->AfterFormImportData(this);
- }
return TRUE;
}
-void CPDF_InterForm::SetFormNotify(const CPDF_FormNotify* pNotify) {
- m_pFormNotify = (CPDF_FormNotify*)pNotify;
+
+void CPDF_InterForm::SetFormNotify(IPDF_FormNotify* pNotify) {
+ m_pFormNotify = pNotify;
}
diff --git a/core/fpdfdoc/doc_formcontrol.cpp b/core/fpdfdoc/doc_formcontrol.cpp
index aa6cf986f1..9b3cf1e5de 100644
--- a/core/fpdfdoc/doc_formcontrol.cpp
+++ b/core/fpdfdoc/doc_formcontrol.cpp
@@ -13,34 +13,43 @@
#include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h"
#include "core/fpdfdoc/include/fpdf_doc.h"
+namespace {
+
+const FX_CHAR* const g_sHighlightingMode[] = {
+ // Must match order of HighlightingMode enum.
+ "N", "I", "O", "P", "T"};
+
+} // namespace
+
CPDF_FormControl::CPDF_FormControl(CPDF_FormField* pField,
- CPDF_Dictionary* pWidgetDict) {
- m_pField = pField;
- m_pWidgetDict = pWidgetDict;
- m_pForm = m_pField->m_pForm;
-}
+ CPDF_Dictionary* pWidgetDict)
+ : m_pField(pField),
+ m_pWidgetDict(pWidgetDict),
+ m_pForm(m_pField->m_pForm) {}
+
CFX_FloatRect CPDF_FormControl::GetRect() const {
return m_pWidgetDict->GetRectBy("Rect");
}
+
CFX_ByteString CPDF_FormControl::GetOnStateName() const {
ASSERT(GetType() == CPDF_FormField::CheckBox ||
GetType() == CPDF_FormField::RadioButton);
CFX_ByteString csOn;
CPDF_Dictionary* pAP = m_pWidgetDict->GetDictBy("AP");
- if (!pAP) {
+ if (!pAP)
return csOn;
- }
+
CPDF_Dictionary* pN = pAP->GetDictBy("N");
- if (!pN) {
+ if (!pN)
return csOn;
- }
+
for (const auto& it : *pN) {
- if (it.first != "Off") {
+ if (it.first != "Off")
return it.first;
- }
}
return CFX_ByteString();
}
+
void CPDF_FormControl::SetOnStateName(const CFX_ByteString& csOn) {
ASSERT(GetType() == CPDF_FormField::CheckBox ||
GetType() == CPDF_FormField::RadioButton);
@@ -99,7 +108,8 @@ CFX_ByteString CPDF_FormControl::GetCheckedAPState() {
csOn = "Yes";
return csOn;
}
-CFX_WideString CPDF_FormControl::GetExportValue() {
+
+CFX_WideString CPDF_FormControl::GetExportValue() const {
ASSERT(GetType() == CPDF_FormField::CheckBox ||
GetType() == CPDF_FormField::RadioButton);
CFX_ByteString csOn = GetOnStateName();
@@ -111,11 +121,9 @@ CFX_WideString CPDF_FormControl::GetExportValue() {
csOn = pArray->GetStringAt(iIndex);
}
}
- if (csOn.IsEmpty()) {
+ if (csOn.IsEmpty())
csOn = "Yes";
- }
- CFX_WideString csWOn = PDF_DecodeText(csOn);
- return csWOn;
+ return PDF_DecodeText(csOn);
}
bool CPDF_FormControl::IsChecked() const {
@@ -144,29 +152,25 @@ void CPDF_FormControl::CheckControl(FX_BOOL bChecked) {
CFX_ByteString csOn = GetOnStateName();
CFX_ByteString csOldAS = m_pWidgetDict->GetStringBy("AS", "Off");
CFX_ByteString csAS = "Off";
- if (bChecked) {
+ if (bChecked)
csAS = csOn;
- }
- if (csOldAS == csAS) {
+ if (csOldAS == csAS)
return;
- }
m_pWidgetDict->SetAtName("AS", csAS);
- m_pForm->m_bUpdated = TRUE;
}
-CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict,
- CPDF_Annot::AppearanceMode mode);
+
void CPDF_FormControl::DrawControl(CFX_RenderDevice* pDevice,
CFX_Matrix* pMatrix,
CPDF_Page* pPage,
CPDF_Annot::AppearanceMode mode,
const CPDF_RenderOptions* pOptions) {
- if (m_pWidgetDict->GetIntegerBy("F") & ANNOTFLAG_HIDDEN) {
+ if (m_pWidgetDict->GetIntegerBy("F") & ANNOTFLAG_HIDDEN)
return;
- }
+
CPDF_Stream* pStream = FPDFDOC_GetAnnotAP(m_pWidgetDict, mode);
- if (!pStream) {
+ if (!pStream)
return;
- }
+
CFX_FloatRect form_bbox = pStream->GetDict()->GetRectBy("BBox");
CFX_Matrix form_matrix = pStream->GetDict()->GetMatrixBy("Matrix");
form_matrix.TransformRect(form_bbox);
@@ -181,15 +185,13 @@ void CPDF_FormControl::DrawControl(CFX_RenderDevice* pDevice,
context.AppendLayer(&form, &matrix);
context.Render(pDevice, pOptions, nullptr);
}
-static const FX_CHAR* const g_sHighlightingMode[] = {
- // Must match order of HiglightingMode enum.
- "N", "I", "O", "P", "T", nullptr};
+
CPDF_FormControl::HighlightingMode CPDF_FormControl::GetHighlightingMode() {
- if (!m_pWidgetDict) {
+ if (!m_pWidgetDict)
return Invert;
- }
+
CFX_ByteString csH = m_pWidgetDict->GetStringBy("H", "I");
- for (int i = 0; g_sHighlightingMode[i]; ++i) {
+ for (size_t i = 0; i < FX_ArraySize(g_sHighlightingMode); ++i) {
if (csH == g_sHighlightingMode[i])
return static_cast<HighlightingMode>(i);
}
@@ -241,16 +243,16 @@ int CPDF_FormControl::GetTextPosition() {
}
CPDF_Action CPDF_FormControl::GetAction() {
- if (!m_pWidgetDict) {
+ if (!m_pWidgetDict)
return CPDF_Action();
- }
- if (m_pWidgetDict->KeyExist("A")) {
+
+ if (m_pWidgetDict->KeyExist("A"))
return CPDF_Action(m_pWidgetDict->GetDictBy("A"));
- }
+
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pField->m_pDict, "A");
- if (!pObj) {
+ if (!pObj)
return CPDF_Action();
- }
+
return CPDF_Action(pObj->GetDict());
}
diff --git a/core/fpdfdoc/doc_formfield.cpp b/core/fpdfdoc/doc_formfield.cpp
index 9849fa1e35..310f0754bf 100644
--- a/core/fpdfdoc/doc_formfield.cpp
+++ b/core/fpdfdoc/doc_formfield.cpp
@@ -14,25 +14,28 @@
#include "core/fpdfdoc/doc_utils.h"
#include "core/fpdfdoc/include/fpdf_doc.h"
-FX_BOOL PDF_FormField_IsUnison(CPDF_FormField* pField) {
- FX_BOOL bUnison = FALSE;
- if (pField->GetType() == CPDF_FormField::CheckBox) {
- bUnison = TRUE;
- } else {
- uint32_t dwFlags = pField->GetFieldFlags();
- bUnison = ((dwFlags & 0x2000000) != 0);
- }
- return bUnison;
+namespace {
+
+bool PDF_FormField_IsUnison(CPDF_FormField* pField) {
+ if (pField->GetType() == CPDF_FormField::CheckBox)
+ return true;
+
+ return (pField->GetFieldFlags() & 0x2000000) != 0;
}
-CPDF_FormField::CPDF_FormField(CPDF_InterForm* pForm, CPDF_Dictionary* pDict) {
- m_pDict = pDict;
- m_Type = Unknown;
- m_pForm = pForm;
- m_pFont = NULL;
- m_FontSize = 0;
+
+} // namespace
+
+CPDF_FormField::CPDF_FormField(CPDF_InterForm* pForm, CPDF_Dictionary* pDict)
+ : m_Type(Unknown),
+ m_pForm(pForm),
+ m_pDict(pDict),
+ m_FontSize(0),
+ m_pFont(nullptr) {
SyncFieldFlags();
}
+
CPDF_FormField::~CPDF_FormField() {}
+
void CPDF_FormField::SyncFieldFlags() {
CFX_ByteString type_name = FPDF_GetFieldAttr(m_pDict, "FT")
? FPDF_GetFieldAttr(m_pDict, "FT")->GetString()
@@ -105,6 +108,7 @@ void CPDF_FormField::SyncFieldFlags() {
CFX_WideString CPDF_FormField::GetFullName() {
return ::GetFullName(m_pDict);
}
+
FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) {
switch (m_Type) {
case CPDF_FormField::CheckBox:
@@ -127,41 +131,20 @@ FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) {
m_pForm->m_pFormNotify->AfterCheckedStatusChange(this);
}
} break;
- case CPDF_FormField::ComboBox: {
- CFX_WideString csValue;
- ClearSelection();
- int iIndex = GetDefaultSelectedItem();
- if (iIndex >= 0) {
- csValue = GetOptionLabel(iIndex);
- }
- if (bNotify && m_pForm->m_pFormNotify) {
- int iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, csValue);
- if (iRet < 0) {
- return FALSE;
- }
- }
- SetItemSelection(iIndex, TRUE);
- if (bNotify && m_pForm->m_pFormNotify) {
- m_pForm->m_pFormNotify->AfterValueChange(this);
- }
- } break;
+ case CPDF_FormField::ComboBox:
case CPDF_FormField::ListBox: {
CFX_WideString csValue;
ClearSelection();
int iIndex = GetDefaultSelectedItem();
- if (iIndex >= 0) {
+ if (iIndex >= 0)
csValue = GetOptionLabel(iIndex);
- }
- if (bNotify && m_pForm->m_pFormNotify) {
- int iRet = m_pForm->m_pFormNotify->BeforeSelectionChange(this, csValue);
- if (iRet < 0) {
- return FALSE;
- }
- }
+
+ if (bNotify && !NotifyListOrComboBoxBeforeChange(csValue))
+ return FALSE;
+
SetItemSelection(iIndex, TRUE);
- if (bNotify && m_pForm->m_pFormNotify) {
- m_pForm->m_pFormNotify->AfterSelectionChange(this);
- }
+ if (bNotify)
+ NotifyListOrComboBoxAfterChange();
} break;
case CPDF_FormField::Text:
case CPDF_FormField::RichText:
@@ -169,29 +152,26 @@ FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) {
default: {
CPDF_Object* pDV = FPDF_GetFieldAttr(m_pDict, "DV");
CFX_WideString csDValue;
- if (pDV) {
+ if (pDV)
csDValue = pDV->GetUnicodeText();
- }
+
CPDF_Object* pV = FPDF_GetFieldAttr(m_pDict, "V");
CFX_WideString csValue;
- if (pV) {
+ if (pV)
csValue = pV->GetUnicodeText();
- }
+
CPDF_Object* pRV = FPDF_GetFieldAttr(m_pDict, "RV");
- if (!pRV && (csDValue == csValue)) {
+ if (!pRV && (csDValue == csValue))
return FALSE;
- }
- if (bNotify && m_pForm->m_pFormNotify) {
- int iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, csDValue);
- if (iRet < 0) {
- return FALSE;
- }
- }
+
+ if (bNotify && !NotifyBeforeValueChange(csDValue))
+ return FALSE;
+
if (pDV) {
CPDF_Object* pClone = pDV->Clone();
- if (!pClone) {
+ if (!pClone)
return FALSE;
- }
+
m_pDict->SetAt("V", pClone);
if (pRV) {
CPDF_Object* pCloneR = pDV->Clone();
@@ -201,18 +181,17 @@ FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) {
m_pDict->RemoveAt("V");
m_pDict->RemoveAt("RV");
}
- if (bNotify && m_pForm->m_pFormNotify) {
- m_pForm->m_pFormNotify->AfterValueChange(this);
- }
- m_pForm->m_bUpdated = TRUE;
+ if (bNotify)
+ NotifyAfterValueChange();
} break;
}
return TRUE;
}
+
int CPDF_FormField::GetControlIndex(const CPDF_FormControl* pControl) {
- if (!pControl) {
+ if (!pControl)
return -1;
- }
+
for (int i = 0; i < m_ControlList.GetSize(); i++) {
if (m_ControlList.GetAt(i) == pControl)
return i;
@@ -284,9 +263,9 @@ CFX_WideString CPDF_FormField::GetRichTextString() {
return pObj->GetUnicodeText();
}
CFX_WideString CPDF_FormField::GetValue(FX_BOOL bDefault) {
- if (GetType() == CheckBox || GetType() == RadioButton) {
+ if (GetType() == CheckBox || GetType() == RadioButton)
return GetCheckValue(bDefault);
- }
+
CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, bDefault ? "DV" : "V");
if (!pValue) {
if (!bDefault) {
@@ -297,9 +276,8 @@ CFX_WideString CPDF_FormField::GetValue(FX_BOOL bDefault) {
pValue = FPDF_GetFieldAttr(m_pDict, "DV");
}
}
- if (!pValue) {
+ if (!pValue)
return CFX_WideString();
- }
}
switch (pValue->GetType()) {
case CPDF_Object::STRING:
@@ -315,12 +293,15 @@ CFX_WideString CPDF_FormField::GetValue(FX_BOOL bDefault) {
}
return CFX_WideString();
}
+
CFX_WideString CPDF_FormField::GetValue() {
return GetValue(FALSE);
}
+
CFX_WideString CPDF_FormField::GetDefaultValue() {
return GetValue(TRUE);
}
+
FX_BOOL CPDF_FormField::SetValue(const CFX_WideString& value,
FX_BOOL bDefault,
FX_BOOL bNotify) {
@@ -335,70 +316,55 @@ FX_BOOL CPDF_FormField::SetValue(const CFX_WideString& value,
case Text:
case ComboBox: {
CFX_WideString csValue = value;
- if (bNotify && m_pForm->m_pFormNotify) {
- int iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, csValue);
- if (iRet < 0) {
- return FALSE;
- }
- }
+ if (bNotify && !NotifyBeforeValueChange(csValue))
+ return FALSE;
+
int iIndex = FindOptionValue(csValue);
if (iIndex < 0) {
CFX_ByteString bsEncodeText = PDF_EncodeText(csValue);
m_pDict->SetAtString(bDefault ? "DV" : "V", bsEncodeText);
- if (m_Type == RichText && !bDefault) {
+ if (m_Type == RichText && !bDefault)
m_pDict->SetAtString("RV", bsEncodeText);
- }
m_pDict->RemoveAt("I");
} else {
m_pDict->SetAtString(bDefault ? "DV" : "V", PDF_EncodeText(csValue));
- if (bDefault) {
- } else {
+ if (!bDefault) {
ClearSelection();
SetItemSelection(iIndex, TRUE);
}
}
- if (bNotify && m_pForm->m_pFormNotify) {
- m_pForm->m_pFormNotify->AfterValueChange(this);
- }
- m_pForm->m_bUpdated = TRUE;
+ if (bNotify)
+ NotifyAfterValueChange();
} break;
case ListBox: {
int iIndex = FindOptionValue(value);
- if (iIndex < 0) {
+ if (iIndex < 0)
return FALSE;
- }
- if (bDefault && iIndex == GetDefaultSelectedItem()) {
+
+ if (bDefault && iIndex == GetDefaultSelectedItem())
return FALSE;
- }
- if (bNotify && m_pForm->m_pFormNotify) {
- CFX_WideString csValue = value;
- int iRet = m_pForm->m_pFormNotify->BeforeSelectionChange(this, csValue);
- if (iRet < 0) {
- return FALSE;
- }
- }
- if (bDefault) {
- } else {
+
+ if (bNotify && !NotifyBeforeSelectionChange(value))
+ return FALSE;
+
+ if (!bDefault) {
ClearSelection();
SetItemSelection(iIndex, TRUE);
}
- if (bNotify && m_pForm->m_pFormNotify) {
- m_pForm->m_pFormNotify->AfterSelectionChange(this);
- }
- m_pForm->m_bUpdated = TRUE;
+ if (bNotify)
+ NotifyAfterSelectionChange();
break;
}
default:
break;
}
- if (CPDF_InterForm::m_bUpdateAP) {
- UpdateAP(NULL);
- }
return TRUE;
}
+
FX_BOOL CPDF_FormField::SetValue(const CFX_WideString& value, FX_BOOL bNotify) {
return SetValue(value, FALSE, bNotify);
}
+
int CPDF_FormField::GetMaxLen() {
if (CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "MaxLen"))
return pObj->GetInteger();
@@ -467,38 +433,21 @@ int CPDF_FormField::GetSelectedIndex(int index) {
}
return -1;
}
+
FX_BOOL CPDF_FormField::ClearSelection(FX_BOOL bNotify) {
if (bNotify && m_pForm->m_pFormNotify) {
- int iRet = 0;
CFX_WideString csValue;
int iIndex = GetSelectedIndex(0);
- if (iIndex >= 0) {
+ if (iIndex >= 0)
csValue = GetOptionLabel(iIndex);
- }
- if (GetType() == ListBox) {
- iRet = m_pForm->m_pFormNotify->BeforeSelectionChange(this, csValue);
- }
- if (GetType() == ComboBox) {
- iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, csValue);
- }
- if (iRet < 0) {
+
+ if (!NotifyListOrComboBoxBeforeChange(csValue))
return FALSE;
- }
}
m_pDict->RemoveAt("V");
m_pDict->RemoveAt("I");
- if (bNotify && m_pForm->m_pFormNotify) {
- if (GetType() == ListBox) {
- m_pForm->m_pFormNotify->AfterSelectionChange(this);
- }
- if (GetType() == ComboBox) {
- m_pForm->m_pFormNotify->AfterValueChange(this);
- }
- }
- if (CPDF_InterForm::m_bUpdateAP) {
- UpdateAP(NULL);
- }
- m_pForm->m_bUpdated = TRUE;
+ if (bNotify)
+ NotifyListOrComboBoxAfterChange();
return TRUE;
}
@@ -551,31 +500,42 @@ FX_BOOL CPDF_FormField::SetItemSelection(int index,
FX_BOOL bSelected,
FX_BOOL bNotify) {
ASSERT(GetType() == ComboBox || GetType() == ListBox);
- if (index < 0 || index >= CountOptions()) {
+ if (index < 0 || index >= CountOptions())
return FALSE;
- }
+
CFX_WideString opt_value = GetOptionValue(index);
- if (bNotify && m_pForm->m_pFormNotify) {
- int iRet = 0;
+ if (bNotify && !NotifyListOrComboBoxBeforeChange(opt_value))
+ return FALSE;
+
+ if (bSelected) {
if (GetType() == ListBox) {
- iRet = m_pForm->m_pFormNotify->BeforeSelectionChange(this, opt_value);
- }
- if (GetType() == ComboBox) {
- iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, opt_value);
- }
- if (iRet < 0) {
- return FALSE;
+ SelectOption(index, TRUE);
+ if (!(m_Flags & FORMLIST_MULTISELECT)) {
+ m_pDict->SetAtString("V", PDF_EncodeText(opt_value));
+ } else {
+ CPDF_Array* pArray = new CPDF_Array;
+ for (int i = 0; i < CountOptions(); i++) {
+ if (i == index || IsItemSelected(i)) {
+ opt_value = GetOptionValue(i);
+ pArray->AddString(PDF_EncodeText(opt_value));
+ }
+ }
+ m_pDict->SetAt("V", pArray);
+ }
+ } else {
+ m_pDict->SetAtString("V", PDF_EncodeText(opt_value));
+ CPDF_Array* pI = new CPDF_Array;
+ pI->AddInteger(index);
+ m_pDict->SetAt("I", pI);
}
- }
- if (!bSelected) {
+ } else {
CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V");
if (pValue) {
- if (m_Type == ListBox) {
+ if (GetType() == ListBox) {
SelectOption(index, FALSE);
if (pValue->IsString()) {
- if (pValue->GetUnicodeText() == opt_value) {
+ if (pValue->GetUnicodeText() == opt_value)
m_pDict->RemoveAt("V");
- }
} else if (pValue->IsArray()) {
CPDF_Array* pArray = new CPDF_Array;
for (int i = 0; i < CountOptions(); i++) {
@@ -589,45 +549,14 @@ FX_BOOL CPDF_FormField::SetItemSelection(int index,
else
m_pDict->SetAt("V", pArray);
}
- } else if (m_Type == ComboBox) {
+ } else {
m_pDict->RemoveAt("V");
m_pDict->RemoveAt("I");
}
}
- } else {
- if (m_Type == ListBox) {
- SelectOption(index, TRUE);
- if (!(m_Flags & FORMLIST_MULTISELECT)) {
- m_pDict->SetAtString("V", PDF_EncodeText(opt_value));
- } else {
- CPDF_Array* pArray = new CPDF_Array;
- for (int i = 0; i < CountOptions(); i++) {
- if (i == index || IsItemSelected(i)) {
- opt_value = GetOptionValue(i);
- pArray->AddString(PDF_EncodeText(opt_value));
- }
- }
- m_pDict->SetAt("V", pArray);
- }
- } else if (m_Type == ComboBox) {
- m_pDict->SetAtString("V", PDF_EncodeText(opt_value));
- CPDF_Array* pI = new CPDF_Array;
- pI->AddInteger(index);
- m_pDict->SetAt("I", pI);
- }
}
- if (bNotify && m_pForm->m_pFormNotify) {
- if (GetType() == ListBox) {
- m_pForm->m_pFormNotify->AfterSelectionChange(this);
- }
- if (GetType() == ComboBox) {
- m_pForm->m_pFormNotify->AfterValueChange(this);
- }
- }
- if (CPDF_InterForm::m_bUpdateAP) {
- UpdateAP(NULL);
- }
- m_pForm->m_bUpdated = TRUE;
+ if (bNotify)
+ NotifyListOrComboBoxAfterChange();
return TRUE;
}
@@ -654,17 +583,6 @@ int CPDF_FormField::GetDefaultSelectedItem() {
return -1;
}
-void CPDF_FormField::UpdateAP(CPDF_FormControl* pControl) {
- if (m_Type == PushButton || m_Type == RadioButton || m_Type == CheckBox)
- return;
- if (!m_pForm->m_bGenerateAP)
- return;
- for (int i = 0; i < CountControls(); i++) {
- CPDF_FormControl* pControl = GetControl(i);
- FPDF_GenerateAP(m_pForm->m_pDocument, pControl->m_pWidgetDict);
- }
-}
-
int CPDF_FormField::CountOptions() {
CPDF_Array* pArray = ToArray(FPDF_GetFieldAttr(m_pDict, "Opt"));
return pArray ? pArray->GetCount() : 0;
@@ -714,15 +632,8 @@ int CPDF_FormField::InsertOption(CFX_WideString csOptLabel,
if (csOptLabel.IsEmpty())
return -1;
- if (bNotify && m_pForm->m_pFormNotify) {
- int iRet = 0;
- if (GetType() == ListBox)
- iRet = m_pForm->m_pFormNotify->BeforeSelectionChange(this, csOptLabel);
- if (GetType() == ComboBox)
- iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, csOptLabel);
- if (iRet < 0)
- return -1;
- }
+ if (bNotify && !NotifyListOrComboBoxBeforeChange(csOptLabel))
+ return -1;
CFX_ByteString csStr =
PDF_EncodeText(csOptLabel.c_str(), csOptLabel.GetLength());
@@ -742,27 +653,18 @@ int CPDF_FormField::InsertOption(CFX_WideString csOptLabel,
pOpt->InsertAt(index, pString);
}
- if (bNotify && m_pForm->m_pFormNotify) {
- if (GetType() == ListBox)
- m_pForm->m_pFormNotify->AfterSelectionChange(this);
- if (GetType() == ComboBox)
- m_pForm->m_pFormNotify->AfterValueChange(this);
- }
- m_pForm->m_bUpdated = TRUE;
+ if (bNotify)
+ NotifyListOrComboBoxAfterChange();
return index;
}
+
FX_BOOL CPDF_FormField::ClearOptions(FX_BOOL bNotify) {
if (bNotify && m_pForm->m_pFormNotify) {
- int iRet = 0;
CFX_WideString csValue;
int iIndex = GetSelectedIndex(0);
if (iIndex >= 0)
csValue = GetOptionLabel(iIndex);
- if (GetType() == ListBox)
- iRet = m_pForm->m_pFormNotify->BeforeSelectionChange(this, csValue);
- if (GetType() == ComboBox)
- iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, csValue);
- if (iRet < 0)
+ if (!NotifyListOrComboBoxBeforeChange(csValue))
return FALSE;
}
@@ -772,17 +674,13 @@ FX_BOOL CPDF_FormField::ClearOptions(FX_BOOL bNotify) {
m_pDict->RemoveAt("I");
m_pDict->RemoveAt("TI");
- if (bNotify && m_pForm->m_pFormNotify) {
- if (GetType() == ListBox)
- m_pForm->m_pFormNotify->AfterSelectionChange(this);
- if (GetType() == ComboBox)
- m_pForm->m_pFormNotify->AfterValueChange(this);
- }
+ if (bNotify)
+ NotifyListOrComboBoxAfterChange();
- m_pForm->m_bUpdated = TRUE;
return TRUE;
}
#endif // PDF_ENABLE_XFA
+
FX_BOOL CPDF_FormField::CheckControl(int iControlIndex,
bool bChecked,
bool bNotify) {
@@ -797,7 +695,7 @@ FX_BOOL CPDF_FormField::CheckControl(int iControlIndex,
CFX_WideString csWExport = pControl->GetExportValue();
CFX_ByteString csBExport = PDF_EncodeText(csWExport);
int iCount = CountControls();
- FX_BOOL bUnison = PDF_FormField_IsUnison(this);
+ bool bUnison = PDF_FormField_IsUnison(this);
for (int i = 0; i < iCount; i++) {
CPDF_FormControl* pCtrl = GetControl(i);
if (bUnison) {
@@ -838,24 +736,19 @@ FX_BOOL CPDF_FormField::CheckControl(int iControlIndex,
csIndex.Format("%d", iControlIndex);
m_pDict->SetAtName("V", csIndex);
}
- if (bNotify && m_pForm->m_pFormNotify) {
+ if (bNotify && m_pForm->m_pFormNotify)
m_pForm->m_pFormNotify->AfterCheckedStatusChange(this);
- }
- m_pForm->m_bUpdated = TRUE;
return TRUE;
}
+
CFX_WideString CPDF_FormField::GetCheckValue(FX_BOOL bDefault) {
ASSERT(GetType() == CheckBox || GetType() == RadioButton);
CFX_WideString csExport = L"Off";
- FX_BOOL bChecked;
int iCount = CountControls();
for (int i = 0; i < iCount; i++) {
CPDF_FormControl* pControl = GetControl(i);
- if (bDefault) {
- bChecked = pControl->IsDefaultChecked();
- } else {
- bChecked = pControl->IsChecked();
- }
+ FX_BOOL bChecked =
+ bDefault ? pControl->IsDefaultChecked() : pControl->IsChecked();
if (bChecked) {
csExport = pControl->GetExportValue();
break;
@@ -863,6 +756,7 @@ CFX_WideString CPDF_FormField::GetCheckValue(FX_BOOL bDefault) {
}
return csExport;
}
+
FX_BOOL CPDF_FormField::SetCheckValue(const CFX_WideString& value,
FX_BOOL bDefault,
FX_BOOL bNotify) {
@@ -871,23 +765,14 @@ FX_BOOL CPDF_FormField::SetCheckValue(const CFX_WideString& value,
for (int i = 0; i < iCount; i++) {
CPDF_FormControl* pControl = GetControl(i);
CFX_WideString csExport = pControl->GetExportValue();
- if (csExport == value) {
- if (bDefault) {
- } else {
- CheckControl(GetControlIndex(pControl), TRUE);
- }
+ bool val = csExport == value;
+ if (!bDefault)
+ CheckControl(GetControlIndex(pControl), val);
+ if (val)
break;
- } else {
- if (bDefault) {
- } else {
- CheckControl(GetControlIndex(pControl), FALSE);
- }
- }
}
- if (bNotify && m_pForm->m_pFormNotify) {
+ if (bNotify && m_pForm->m_pFormNotify)
m_pForm->m_pFormNotify->AfterCheckedStatusChange(this);
- }
- m_pForm->m_bUpdated = TRUE;
return TRUE;
}
@@ -929,131 +814,153 @@ FX_BOOL CPDF_FormField::SelectOption(int iOptIndex,
FX_BOOL bNotify) {
CPDF_Array* pArray = m_pDict->GetArrayBy("I");
if (!pArray) {
- if (!bSelected) {
+ if (!bSelected)
return TRUE;
- }
+
pArray = new CPDF_Array;
m_pDict->SetAt("I", pArray);
}
+
FX_BOOL bReturn = FALSE;
for (size_t i = 0; i < pArray->GetCount(); i++) {
int iFind = pArray->GetIntegerAt(i);
if (iFind == iOptIndex) {
- if (bSelected) {
+ if (bSelected)
return TRUE;
- }
+
if (bNotify && m_pForm->m_pFormNotify) {
- int iRet = 0;
CFX_WideString csValue = GetOptionLabel(iOptIndex);
- if (GetType() == ListBox) {
- iRet = m_pForm->m_pFormNotify->BeforeSelectionChange(this, csValue);
- }
- if (GetType() == ComboBox) {
- iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, csValue);
- }
- if (iRet < 0) {
+ if (!NotifyListOrComboBoxBeforeChange(csValue))
return FALSE;
- }
}
pArray->RemoveAt(i);
bReturn = TRUE;
break;
- } else if (iFind > iOptIndex) {
- if (!bSelected) {
+ }
+
+ if (iFind > iOptIndex) {
+ if (!bSelected)
continue;
- }
+
if (bNotify && m_pForm->m_pFormNotify) {
- int iRet = 0;
CFX_WideString csValue = GetOptionLabel(iOptIndex);
- if (GetType() == ListBox) {
- iRet = m_pForm->m_pFormNotify->BeforeSelectionChange(this, csValue);
- }
- if (GetType() == ComboBox) {
- iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, csValue);
- }
- if (iRet < 0) {
+ if (!NotifyListOrComboBoxBeforeChange(csValue))
return FALSE;
- }
}
- CPDF_Number* pNum = new CPDF_Number(iOptIndex);
- pArray->InsertAt(i, pNum);
+ pArray->InsertAt(i, new CPDF_Number(iOptIndex));
bReturn = TRUE;
break;
}
}
if (!bReturn) {
- if (bSelected) {
+ if (bSelected)
pArray->AddInteger(iOptIndex);
- }
- if (pArray->GetCount() == 0) {
+
+ if (pArray->GetCount() == 0)
m_pDict->RemoveAt("I");
- }
}
- if (bNotify && m_pForm->m_pFormNotify) {
- if (GetType() == ListBox) {
- m_pForm->m_pFormNotify->AfterSelectionChange(this);
- }
- if (GetType() == ComboBox) {
- m_pForm->m_pFormNotify->AfterValueChange(this);
- }
- }
- m_pForm->m_bUpdated = TRUE;
+ if (bNotify)
+ NotifyListOrComboBoxAfterChange();
+
return TRUE;
}
+
FX_BOOL CPDF_FormField::ClearSelectedOptions(FX_BOOL bNotify) {
if (bNotify && m_pForm->m_pFormNotify) {
- int iRet = 0;
CFX_WideString csValue;
int iIndex = GetSelectedIndex(0);
- if (iIndex >= 0) {
+ if (iIndex >= 0)
csValue = GetOptionLabel(iIndex);
- }
- if (GetType() == ListBox) {
- iRet = m_pForm->m_pFormNotify->BeforeSelectionChange(this, csValue);
- }
- if (GetType() == ComboBox) {
- iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, csValue);
- }
- if (iRet < 0) {
+
+ if (!NotifyListOrComboBoxBeforeChange(csValue))
return FALSE;
- }
}
m_pDict->RemoveAt("I");
- if (bNotify && m_pForm->m_pFormNotify) {
- if (GetType() == ListBox) {
- m_pForm->m_pFormNotify->AfterSelectionChange(this);
- }
- if (GetType() == ComboBox) {
- m_pForm->m_pFormNotify->AfterValueChange(this);
- }
- }
- m_pForm->m_bUpdated = TRUE;
+ if (bNotify)
+ NotifyListOrComboBoxAfterChange();
+
return TRUE;
}
+
void CPDF_FormField::LoadDA() {
+ CPDF_Dictionary* pFormDict = m_pForm->m_pFormDict;
+ if (!pFormDict)
+ return;
+
CFX_ByteString DA;
- if (CPDF_Object* pObj_t = FPDF_GetFieldAttr(m_pDict, "DA")) {
- DA = pObj_t->GetString();
- }
- if (DA.IsEmpty() && m_pForm->m_pFormDict) {
- DA = m_pForm->m_pFormDict->GetStringBy("DA");
- }
- if (DA.IsEmpty()) {
+ if (CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "DA"))
+ DA = pObj->GetString();
+
+ if (DA.IsEmpty())
+ DA = pFormDict->GetStringBy("DA");
+
+ if (DA.IsEmpty())
return;
- }
+
+ CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR");
+ if (!pDR)
+ return;
+
+ CPDF_Dictionary* pFont = pDR->GetDictBy("Font");
+ if (!pFont)
+ return;
+
CPDF_SimpleParser syntax(DA.AsStringC());
syntax.FindTagParamFromStart("Tf", 2);
CFX_ByteString font_name(syntax.GetWord());
- CPDF_Dictionary* pFontDict = NULL;
- if (m_pForm->m_pFormDict && m_pForm->m_pFormDict->GetDictBy("DR") &&
- m_pForm->m_pFormDict->GetDictBy("DR")->GetDictBy("Font")) {
- pFontDict = m_pForm->m_pFormDict->GetDictBy("DR")
- ->GetDictBy("Font")
- ->GetDictBy(font_name);
- }
- if (!pFontDict) {
+ CPDF_Dictionary* pFontDict = pFont->GetDictBy(font_name);
+ if (!pFontDict)
return;
- }
+
m_pFont = m_pForm->m_pDocument->LoadFont(pFontDict);
m_FontSize = FX_atof(syntax.GetWord());
}
+
+bool CPDF_FormField::NotifyBeforeSelectionChange(const CFX_WideString& value) {
+ if (!m_pForm->m_pFormNotify)
+ return true;
+ return m_pForm->m_pFormNotify->BeforeSelectionChange(this, value) >= 0;
+}
+
+void CPDF_FormField::NotifyAfterSelectionChange() {
+ if (!m_pForm->m_pFormNotify)
+ return;
+ m_pForm->m_pFormNotify->AfterSelectionChange(this);
+}
+
+bool CPDF_FormField::NotifyBeforeValueChange(const CFX_WideString& value) {
+ if (!m_pForm->m_pFormNotify)
+ return true;
+ return m_pForm->m_pFormNotify->BeforeValueChange(this, value) >= 0;
+}
+
+void CPDF_FormField::NotifyAfterValueChange() {
+ if (!m_pForm->m_pFormNotify)
+ return;
+ m_pForm->m_pFormNotify->AfterValueChange(this);
+}
+
+bool CPDF_FormField::NotifyListOrComboBoxBeforeChange(
+ const CFX_WideString& value) {
+ switch (GetType()) {
+ case ListBox:
+ return NotifyBeforeSelectionChange(value);
+ case ComboBox:
+ return NotifyBeforeValueChange(value);
+ default:
+ return true;
+ }
+}
+
+void CPDF_FormField::NotifyListOrComboBoxAfterChange() {
+ switch (GetType()) {
+ case ListBox:
+ NotifyAfterSelectionChange();
+ break;
+ case ComboBox:
+ NotifyAfterValueChange();
+ break;
+ default:
+ break;
+ }
+}
diff --git a/core/fpdfdoc/include/fpdf_doc.h b/core/fpdfdoc/include/fpdf_doc.h
index cb751915d4..4fc5b5232b 100644
--- a/core/fpdfdoc/include/fpdf_doc.h
+++ b/core/fpdfdoc/include/fpdf_doc.h
@@ -18,6 +18,7 @@
class CFDF_Document;
class CFieldTree;
+class CFX_RenderDevice;
class CPDF_AAction;
class CPDF_Action;
class CPDF_ActionFields;
@@ -28,26 +29,24 @@ class CPDF_Bookmark;
class CPDF_BookmarkTree;
class CPDF_DefaultAppearance;
class CPDF_Dest;
-class CPDF_Document;
class CPDF_DocJSActions;
+class CPDF_Document;
class CPDF_FileSpec;
+class CPDF_Font;
+class CPDF_Form;
class CPDF_FormControl;
class CPDF_FormField;
-class CPDF_FormNotify;
class CPDF_IconFit;
-class CPDF_InterForm;
class CPDF_Link;
class CPDF_Metadata;
class CPDF_OCContext;
class CPDF_Page;
class CPDF_PageObject;
-class CPDF_Font;
-class CPDF_Form;
-class CPDF_RenderOptions;
class CPDF_RenderContext;
+class CPDF_RenderOptions;
class CPDF_ViewerPreferences;
class CXML_Element;
-class CFX_RenderDevice;
+class IPDF_FormNotify;
enum class BorderStyle { SOLID, DASH, BEVELED, INSET, UNDERLINE };
@@ -445,9 +444,10 @@ class CPDF_DefaultAppearance {
#define FIELDTYPE_LISTBOX 5
#define FIELDTYPE_TEXTFIELD 6
#define FIELDTYPE_SIGNATURE 7
+
class CPDF_InterForm : public CFX_PrivateData {
public:
- CPDF_InterForm(CPDF_Document* pDocument, FX_BOOL bUpdateAP);
+ explicit CPDF_InterForm(CPDF_Document* pDocument);
~CPDF_InterForm();
static void EnableUpdateAP(FX_BOOL bUpdateAP);
@@ -499,9 +499,7 @@ class CPDF_InterForm : public CFX_PrivateData {
CPDF_Dictionary* GetFormDict() const { return m_pFormDict; }
- FX_BOOL NeedConstructAP();
-
- void NeedConstructAP(FX_BOOL bNeedAP);
+ FX_BOOL NeedConstructAP() const;
int CountFieldsInCalculationOrder();
@@ -569,13 +567,7 @@ class CPDF_InterForm : public CFX_PrivateData {
bool ResetForm(bool bNotify = false);
- CPDF_FormNotify* GetFormNotify() const { return m_pFormNotify; }
-
- void SetFormNotify(const CPDF_FormNotify* pNotify);
-
- FX_BOOL IsUpdated() { return m_bUpdated; }
-
- void ClearUpdatedFlag() { m_bUpdated = FALSE; }
+ void SetFormNotify(IPDF_FormNotify* pNotify);
FX_BOOL HasXFAForm() const;
@@ -611,8 +603,6 @@ class CPDF_InterForm : public CFX_PrivateData {
CPDF_Document* const m_pDocument;
- FX_BOOL m_bGenerateAP;
-
CPDF_Dictionary* m_pFormDict;
std::map<const CPDF_Dictionary*, CPDF_FormControl*> m_ControlMap;
@@ -621,9 +611,8 @@ class CPDF_InterForm : public CFX_PrivateData {
CFX_ByteString m_bsEncoding;
- CPDF_FormNotify* m_pFormNotify;
+ IPDF_FormNotify* m_pFormNotify;
- FX_BOOL m_bUpdated;
friend class CPDF_FormControl;
friend class CPDF_FormField;
};
@@ -664,9 +653,11 @@ class CPDF_FormField {
FX_BOOL ResetField(FX_BOOL bNotify = FALSE);
- int CountControls() { return m_ControlList.GetSize(); }
+ int CountControls() const { return m_ControlList.GetSize(); }
- CPDF_FormControl* GetControl(int index) { return m_ControlList.GetAt(index); }
+ CPDF_FormControl* GetControl(int index) const {
+ return m_ControlList.GetAt(index);
+ }
int GetControlIndex(const CPDF_FormControl* pControl);
@@ -764,14 +755,21 @@ class CPDF_FormField {
void LoadDA();
- void UpdateAP(CPDF_FormControl* pControl);
-
CFX_WideString GetCheckValue(FX_BOOL bDefault);
FX_BOOL SetCheckValue(const CFX_WideString& value,
FX_BOOL bDefault,
FX_BOOL bNotify);
+ bool NotifyBeforeSelectionChange(const CFX_WideString& value);
+ void NotifyAfterSelectionChange();
+
+ bool NotifyBeforeValueChange(const CFX_WideString& value);
+ void NotifyAfterValueChange();
+
+ bool NotifyListOrComboBoxBeforeChange(const CFX_WideString& value);
+ void NotifyListOrComboBoxAfterChange();
+
CPDF_FormField::Type m_Type;
uint32_t m_Flags;
CPDF_InterForm* m_pForm;
@@ -828,7 +826,7 @@ class CPDF_FormControl {
const CPDF_RenderOptions* pOptions = nullptr);
CFX_ByteString GetCheckedAPState();
- CFX_WideString GetExportValue();
+ CFX_WideString GetExportValue() const;
bool IsChecked() const;
bool IsDefaultChecked() const;
@@ -894,17 +892,17 @@ class CPDF_FormControl {
CPDF_Stream* GetIcon(const CFX_ByteString& csEntry);
CPDF_ApSettings GetMK() const;
- CPDF_InterForm* m_pForm;
- CPDF_FormField* m_pField;
- CPDF_Dictionary* m_pWidgetDict;
+ CPDF_FormField* const m_pField;
+ CPDF_Dictionary* const m_pWidgetDict;
+ CPDF_InterForm* const m_pForm;
friend class CPDF_InterForm;
friend class CPDF_FormField;
};
-class CPDF_FormNotify {
+class IPDF_FormNotify {
public:
- virtual ~CPDF_FormNotify() {}
+ virtual ~IPDF_FormNotify() {}
virtual int BeforeValueChange(CPDF_FormField* pField,
const CFX_WideString& csValue) {
@@ -1016,4 +1014,7 @@ class CPDF_ApSettings {
CPDF_Dictionary* const m_pDict;
};
+CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict,
+ CPDF_Annot::AppearanceMode mode);
+
#endif // CORE_FPDFDOC_INCLUDE_FPDF_DOC_H_