Chromium Code Reviews| Index: fpdfsdk/src/fsdk_baseform.cpp |
| diff --git a/fpdfsdk/src/fsdk_baseform.cpp b/fpdfsdk/src/fsdk_baseform.cpp |
| index 98836e9465b7ddd1dd675d74c2a106d75457cb83..2b2520b9163e76bfbb2b3f65061f831e8f2930f5 100644 |
| --- a/fpdfsdk/src/fsdk_baseform.cpp |
| +++ b/fpdfsdk/src/fsdk_baseform.cpp |
| @@ -25,7 +25,7 @@ CPDFSDK_Widget::CPDFSDK_Widget(CPDF_Annot* pAnnot, |
| m_pInterForm(pInterForm), |
| m_nAppAge(0), |
| m_nValueAge(0) { |
| - ASSERT(m_pInterForm != NULL); |
| + ASSERT(m_pInterForm); |
| } |
| CPDFSDK_Widget::~CPDFSDK_Widget() {} |
| @@ -69,10 +69,7 @@ FX_BOOL CPDFSDK_Widget::IsWidgetAppearanceValid( |
| } |
| int CPDFSDK_Widget::GetFieldType() const { |
| - CPDF_FormField* pField = GetFormField(); |
| - ASSERT(pField != NULL); |
| - |
| - return pField->GetFieldType(); |
| + return GetFormField()->GetFieldType(); |
| } |
| FX_BOOL CPDFSDK_Widget::IsAppearanceValid() { |
| @@ -81,8 +78,6 @@ FX_BOOL CPDFSDK_Widget::IsAppearanceValid() { |
| int CPDFSDK_Widget::GetFieldFlags() const { |
| CPDF_InterForm* pPDFInterForm = m_pInterForm->GetInterForm(); |
| - ASSERT(pPDFInterForm != NULL); |
| - |
| CPDF_FormControl* pFormControl = |
| pPDFInterForm->GetControlByDict(m_pAnnot->GetAnnotDict()); |
| CPDF_FormField* pFormField = pFormControl->GetField(); |
| @@ -109,7 +104,7 @@ CPDF_FormControl* CPDFSDK_Widget::GetFormControl() const { |
| CPDF_FormControl* CPDFSDK_Widget::GetFormControl( |
| CPDF_InterForm* pInterForm, |
| const CPDF_Dictionary* pAnnotDict) { |
| - ASSERT(pAnnotDict != NULL); |
| + ASSERT(pAnnotDict); |
| return pInterForm->GetControlByDict(pAnnotDict); |
| } |
| @@ -120,8 +115,6 @@ int CPDFSDK_Widget::GetRotate() const { |
| FX_BOOL CPDFSDK_Widget::GetFillColor(FX_COLORREF& color) const { |
| CPDF_FormControl* pFormCtrl = GetFormControl(); |
| - ASSERT(pFormCtrl != NULL); |
| - |
| int iColorType = 0; |
| color = FX_ARGBTOCOLORREF(pFormCtrl->GetBackgroundColor(iColorType)); |
| @@ -130,8 +123,6 @@ FX_BOOL CPDFSDK_Widget::GetFillColor(FX_COLORREF& color) const { |
| FX_BOOL CPDFSDK_Widget::GetBorderColor(FX_COLORREF& color) const { |
| CPDF_FormControl* pFormCtrl = GetFormControl(); |
| - ASSERT(pFormCtrl != NULL); |
| - |
| int iColorType = 0; |
| color = FX_ARGBTOCOLORREF(pFormCtrl->GetBorderColor(iColorType)); |
| @@ -140,8 +131,6 @@ FX_BOOL CPDFSDK_Widget::GetBorderColor(FX_COLORREF& color) const { |
| FX_BOOL CPDFSDK_Widget::GetTextColor(FX_COLORREF& color) const { |
| CPDF_FormControl* pFormCtrl = GetFormControl(); |
| - ASSERT(pFormCtrl != NULL); |
| - |
| CPDF_DefaultAppearance da = pFormCtrl->GetDefaultAppearance(); |
| if (da.HasColor()) { |
| FX_ARGB argb; |
| @@ -157,8 +146,6 @@ FX_BOOL CPDFSDK_Widget::GetTextColor(FX_COLORREF& color) const { |
| FX_FLOAT CPDFSDK_Widget::GetFontSize() const { |
| CPDF_FormControl* pFormCtrl = GetFormControl(); |
| - ASSERT(pFormCtrl != NULL); |
| - |
| CPDF_DefaultAppearance pDa = pFormCtrl->GetDefaultAppearance(); |
| CFX_ByteString csFont = ""; |
| FX_FLOAT fFontSize = 0.0f; |
| @@ -179,22 +166,16 @@ CFX_WideString CPDFSDK_Widget::GetValue() const { |
| CFX_WideString CPDFSDK_Widget::GetDefaultValue() const { |
| CPDF_FormField* pFormField = GetFormField(); |
| - ASSERT(pFormField != NULL); |
| - |
| return pFormField->GetDefaultValue(); |
| } |
| CFX_WideString CPDFSDK_Widget::GetOptionLabel(int nIndex) const { |
| CPDF_FormField* pFormField = GetFormField(); |
| - ASSERT(pFormField != NULL); |
| - |
| return pFormField->GetOptionLabel(nIndex); |
| } |
| int CPDFSDK_Widget::CountOptions() const { |
| CPDF_FormField* pFormField = GetFormField(); |
| - ASSERT(pFormField != NULL); |
| - |
| return pFormField->CountOptions(); |
| } |
| @@ -215,33 +196,23 @@ FX_BOOL CPDFSDK_Widget::IsChecked() const { |
| int CPDFSDK_Widget::GetAlignment() const { |
| CPDF_FormControl* pFormCtrl = GetFormControl(); |
| - ASSERT(pFormCtrl != NULL); |
| - |
| return pFormCtrl->GetControlAlignment(); |
| } |
| int CPDFSDK_Widget::GetMaxLen() const { |
| CPDF_FormField* pFormField = GetFormField(); |
| - ASSERT(pFormField != NULL); |
| - |
| return pFormField->GetMaxLen(); |
| } |
| void CPDFSDK_Widget::SetCheck(FX_BOOL bChecked, FX_BOOL bNotify) { |
| CPDF_FormControl* pFormCtrl = GetFormControl(); |
| - ASSERT(pFormCtrl != NULL); |
| - |
| CPDF_FormField* pFormField = pFormCtrl->GetField(); |
| - ASSERT(pFormField != NULL); |
| - |
| pFormField->CheckControl(pFormField->GetControlIndex(pFormCtrl), bChecked, |
| bNotify); |
| } |
| void CPDFSDK_Widget::SetValue(const CFX_WideString& sValue, FX_BOOL bNotify) { |
| CPDF_FormField* pFormField = GetFormField(); |
| - ASSERT(pFormField != NULL); |
| - |
| pFormField->SetValue(sValue, bNotify); |
| } |
| @@ -250,15 +221,11 @@ void CPDFSDK_Widget::SetOptionSelection(int index, |
| FX_BOOL bSelected, |
| FX_BOOL bNotify) { |
| CPDF_FormField* pFormField = GetFormField(); |
| - ASSERT(pFormField != NULL); |
| - |
| pFormField->SetItemSelection(index, bSelected, bNotify); |
| } |
| void CPDFSDK_Widget::ClearSelection(FX_BOOL bNotify) { |
| CPDF_FormField* pFormField = GetFormField(); |
| - ASSERT(pFormField != NULL); |
| - |
| pFormField->ClearSelection(bNotify); |
| } |
| @@ -309,22 +276,18 @@ void CPDFSDK_Widget::ResetAppearance(const FX_WCHAR* sValue, |
| break; |
| } |
| - ASSERT(m_pAnnot != NULL); |
| m_pAnnot->ClearCachedAP(); |
| } |
| CFX_WideString CPDFSDK_Widget::OnFormat(FX_BOOL& bFormated) { |
| CPDF_FormField* pFormField = GetFormField(); |
| - ASSERT(pFormField != NULL); |
| + ASSERT(pFormField); |
| return m_pInterForm->OnFormat(pFormField, bFormated); |
| } |
| void CPDFSDK_Widget::ResetFieldAppearance(FX_BOOL bValueChanged) { |
| CPDF_FormField* pFormField = GetFormField(); |
| - ASSERT(pFormField != NULL); |
| - |
| - ASSERT(m_pInterForm != NULL); |
| - |
| + ASSERT(pFormField); |
| m_pInterForm->ResetFieldAppearance(pFormField, NULL, bValueChanged); |
| } |
| @@ -357,16 +320,12 @@ void CPDFSDK_Widget::DrawAppearance(CFX_RenderDevice* pDevice, |
| void CPDFSDK_Widget::UpdateField() { |
| CPDF_FormField* pFormField = GetFormField(); |
| - ASSERT(pFormField != NULL); |
| - |
| - ASSERT(m_pInterForm != NULL); |
| + ASSERT(pFormField); |
| m_pInterForm->UpdateField(pFormField); |
| } |
| void CPDFSDK_Widget::DrawShadow(CFX_RenderDevice* pDevice, |
| CPDFSDK_PageView* pPageView) { |
| - ASSERT(m_pInterForm != NULL); |
| - |
| int nFieldType = GetFieldType(); |
| if (m_pInterForm->IsNeedHighLight(nFieldType)) { |
| CPDF_Rect rc = GetRect(); |
| @@ -396,12 +355,8 @@ void CPDFSDK_Widget::DrawShadow(CFX_RenderDevice* pDevice, |
| void CPDFSDK_Widget::ResetAppearance_PushButton() { |
| CPDF_FormControl* pControl = GetFormControl(); |
| - ASSERT(pControl != NULL); |
| - |
| CPDF_Rect rcWindow = GetRotatedRect(); |
| - |
| int32_t nLayout = 0; |
| - |
| switch (pControl->GetTextPosition()) { |
| case TEXTPOS_ICON: |
| nLayout = PPBL_ICON; |
| @@ -536,7 +491,6 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() { |
| CPDF_IconFit iconFit = pControl->GetIconFit(); |
| CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); |
| - ASSERT(pDoc != NULL); |
| CPDFDoc_Environment* pEnv = pDoc->GetEnv(); |
| CBA_FontMap FontMap(this, pEnv->GetSysHandler()); |
| @@ -618,10 +572,7 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() { |
| void CPDFSDK_Widget::ResetAppearance_CheckBox() { |
| CPDF_FormControl* pControl = GetFormControl(); |
| - ASSERT(pControl != NULL); |
| - |
| CPWL_Color crBackground, crBorder, crText; |
| - |
| int iColorType; |
| FX_FLOAT fc[4]; |
| @@ -747,10 +698,7 @@ void CPDFSDK_Widget::ResetAppearance_CheckBox() { |
| void CPDFSDK_Widget::ResetAppearance_RadioButton() { |
| CPDF_FormControl* pControl = GetFormControl(); |
| - ASSERT(pControl != NULL); |
| - |
| CPWL_Color crBackground, crBorder, crText; |
| - |
| int iColorType; |
| FX_FLOAT fc[4]; |
| @@ -913,10 +861,7 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() { |
| void CPDFSDK_Widget::ResetAppearance_ComboBox(const FX_WCHAR* sValue) { |
| CPDF_FormControl* pControl = GetFormControl(); |
| - ASSERT(pControl != NULL); |
| CPDF_FormField* pField = pControl->GetField(); |
| - ASSERT(pField != NULL); |
| - |
| CFX_ByteTextBuf sBody, sLines; |
| CPDF_Rect rcClient = GetClientRect(); |
| @@ -928,7 +873,6 @@ void CPDFSDK_Widget::ResetAppearance_ComboBox(const FX_WCHAR* sValue) { |
| pEdit->EnableRefresh(FALSE); |
| CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); |
| - ASSERT(pDoc != NULL); |
| CPDFDoc_Environment* pEnv = pDoc->GetEnv(); |
| CBA_FontMap FontMap(this, pEnv->GetSysHandler()); |
| FontMap.Initial(); |
| @@ -992,19 +936,14 @@ void CPDFSDK_Widget::ResetAppearance_ComboBox(const FX_WCHAR* sValue) { |
| void CPDFSDK_Widget::ResetAppearance_ListBox() { |
| CPDF_FormControl* pControl = GetFormControl(); |
| - ASSERT(pControl != NULL); |
| CPDF_FormField* pField = pControl->GetField(); |
| - ASSERT(pField != NULL); |
| - |
| CPDF_Rect rcClient = GetClientRect(); |
| - |
| CFX_ByteTextBuf sBody, sLines; |
| if (IFX_Edit* pEdit = IFX_Edit::NewEdit()) { |
| pEdit->EnableRefresh(FALSE); |
| CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); |
| - ASSERT(pDoc != NULL); |
| CPDFDoc_Environment* pEnv = pDoc->GetEnv(); |
| CBA_FontMap FontMap(this, pEnv->GetSysHandler()); |
| @@ -1086,17 +1025,13 @@ void CPDFSDK_Widget::ResetAppearance_ListBox() { |
| void CPDFSDK_Widget::ResetAppearance_TextField(const FX_WCHAR* sValue) { |
| CPDF_FormControl* pControl = GetFormControl(); |
| - ASSERT(pControl != NULL); |
| CPDF_FormField* pField = pControl->GetField(); |
| - ASSERT(pField != NULL); |
| - |
| CFX_ByteTextBuf sBody, sLines; |
| if (IFX_Edit* pEdit = IFX_Edit::NewEdit()) { |
| pEdit->EnableRefresh(FALSE); |
| CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); |
| - ASSERT(pDoc != NULL); |
| CPDFDoc_Environment* pEnv = pDoc->GetEnv(); |
| CBA_FontMap FontMap(this, pEnv->GetSysHandler()); |
| @@ -1315,8 +1250,6 @@ CFX_ByteString CPDFSDK_Widget::GetBorderAppStream() const { |
| CPDF_Matrix CPDFSDK_Widget::GetMatrix() const { |
| CPDF_Matrix mt; |
| CPDF_FormControl* pControl = GetFormControl(); |
| - ASSERT(pControl != NULL); |
| - |
| CPDF_Rect rcAnnot = GetRect(); |
| FX_FLOAT fWidth = rcAnnot.right - rcAnnot.left; |
| FX_FLOAT fHeight = rcAnnot.top - rcAnnot.bottom; |
| @@ -1344,8 +1277,6 @@ CPWL_Color CPDFSDK_Widget::GetTextPWLColor() const { |
| CPWL_Color crText = CPWL_Color(COLORTYPE_GRAY, 0); |
| CPDF_FormControl* pFormCtrl = GetFormControl(); |
| - ASSERT(pFormCtrl != NULL); |
| - |
| CPDF_DefaultAppearance da = pFormCtrl->GetDefaultAppearance(); |
| if (da.HasColor()) { |
| int32_t iColorType; |
| @@ -1361,8 +1292,6 @@ CPWL_Color CPDFSDK_Widget::GetBorderPWLColor() const { |
| CPWL_Color crBorder; |
| CPDF_FormControl* pFormCtrl = GetFormControl(); |
| - ASSERT(pFormCtrl != NULL); |
| - |
| int32_t iColorType; |
| FX_FLOAT fc[4]; |
| pFormCtrl->GetOriginalBorderColor(iColorType, fc); |
| @@ -1376,8 +1305,6 @@ CPWL_Color CPDFSDK_Widget::GetFillPWLColor() const { |
| CPWL_Color crFill; |
| CPDF_FormControl* pFormCtrl = GetFormControl(); |
| - ASSERT(pFormCtrl != NULL); |
| - |
| int32_t iColorType; |
| FX_FLOAT fc[4]; |
| pFormCtrl->GetOriginalBackgroundColor(iColorType, fc); |
| @@ -1389,20 +1316,12 @@ CPWL_Color CPDFSDK_Widget::GetFillPWLColor() const { |
| void CPDFSDK_Widget::AddImageToAppearance(const CFX_ByteString& sAPType, |
| CPDF_Stream* pImage) { |
| - ASSERT(pImage != NULL); |
| - |
| CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); |
| - ASSERT(pDoc != NULL); |
| + ASSERT(pDoc); |
| CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDict("AP"); |
| - ASSERT(pAPDict != NULL); |
| - |
| CPDF_Stream* pStream = pAPDict->GetStream(sAPType); |
| - ASSERT(pStream != NULL); |
| - |
| CPDF_Dictionary* pStreamDict = pStream->GetDict(); |
| - ASSERT(pStreamDict != NULL); |
| - |
| CFX_ByteString sImageAlias = "IMG"; |
| if (CPDF_Dictionary* pImageDict = pImage->GetDict()) { |
| @@ -1477,8 +1396,6 @@ CPDF_Action CPDFSDK_Widget::GetAAction(CPDF_AAction::AActionType eAAT) { |
| CFX_WideString CPDFSDK_Widget::GetAlternateName() const { |
| CPDF_FormField* pFormField = GetFormField(); |
| - ASSERT(pFormField != NULL); |
| - |
| return pFormField->GetAlternateName(); |
| } |
| @@ -1601,8 +1518,7 @@ void CPDFSDK_InterForm::GetWidgets( |
| int CPDFSDK_InterForm::GetPageIndexByAnnotDict( |
| CPDF_Document* pDocument, |
| CPDF_Dictionary* pAnnotDict) const { |
| - ASSERT(pDocument != NULL); |
| - ASSERT(pAnnotDict != NULL); |
| + ASSERT(pAnnotDict); |
| for (int i = 0, sz = pDocument->GetPageCount(); i < sz; i++) { |
| if (CPDF_Dictionary* pPageDict = pDocument->GetPage(i)) { |
| @@ -1698,7 +1614,6 @@ CPDF_Stream* CPDFSDK_InterForm::LoadImageFromFile(const CFX_WideString& sFile) { |
| #endif |
| void CPDFSDK_InterForm::OnCalculate(CPDF_FormField* pFormField) { |
| - ASSERT(m_pDocument != NULL); |
| CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); |
| ASSERT(pEnv); |
| if (!pEnv->IsJSInitiated()) |
| @@ -1711,8 +1626,6 @@ void CPDFSDK_InterForm::OnCalculate(CPDF_FormField* pFormField) { |
| if (IsCalculateEnabled()) { |
| IJS_Runtime* pRuntime = m_pDocument->GetJsRuntime(); |
| - ASSERT(pRuntime != NULL); |
| - |
| pRuntime->SetReaderDocument(m_pDocument); |
| int nSize = m_pInterForm->CountFieldsInCalculationOrder(); |
| @@ -1728,8 +1641,6 @@ void CPDFSDK_InterForm::OnCalculate(CPDF_FormField* pFormField) { |
| CFX_WideString csJS = action.GetJavaScript(); |
| if (!csJS.IsEmpty()) { |
| IJS_Context* pContext = pRuntime->NewContext(); |
| - ASSERT(pContext != NULL); |
| - |
| CFX_WideString sOldValue = pField->GetValue(); |
| CFX_WideString sValue = sOldValue; |
| FX_BOOL bRC = TRUE; |
| @@ -1758,9 +1669,6 @@ void CPDFSDK_InterForm::OnCalculate(CPDF_FormField* pFormField) { |
| CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField, |
| FX_BOOL& bFormated) { |
| - ASSERT(m_pDocument != NULL); |
| - ASSERT(pFormField != NULL); |
| - |
| CFX_WideString sValue = pFormField->GetValue(); |
| CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); |
| ASSERT(pEnv); |
| @@ -1770,8 +1678,6 @@ CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField, |
| } |
| IJS_Runtime* pRuntime = m_pDocument->GetJsRuntime(); |
| - ASSERT(pRuntime != NULL); |
| - |
| pRuntime->SetReaderDocument(m_pDocument); |
| if (pFormField->GetFieldType() == FIELDTYPE_COMBOBOX) { |
| @@ -1793,8 +1699,6 @@ CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField, |
| CFX_WideString Value = sValue; |
| IJS_Context* pContext = pRuntime->NewContext(); |
| - ASSERT(pContext != NULL); |
| - |
| pContext->OnField_Format(pFormField, Value, TRUE); |
| CFX_WideString sInfo; |
| @@ -1815,13 +1719,9 @@ CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField, |
| void CPDFSDK_InterForm::ResetFieldAppearance(CPDF_FormField* pFormField, |
| const FX_WCHAR* sValue, |
| FX_BOOL bValueChanged) { |
| - ASSERT(pFormField != NULL); |
| - |
| for (int i = 0, sz = pFormField->CountControls(); i < sz; i++) { |
| CPDF_FormControl* pFormCtrl = pFormField->GetControl(i); |
| - ASSERT(pFormCtrl != NULL); |
| - |
| - ASSERT(m_pInterForm != NULL); |
| + ASSERT(pFormCtrl); |
| if (CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl)) |
| pWidget->ResetAppearance(sValue, bValueChanged); |
| } |
| @@ -1830,7 +1730,7 @@ void CPDFSDK_InterForm::ResetFieldAppearance(CPDF_FormField* pFormField, |
| void CPDFSDK_InterForm::UpdateField(CPDF_FormField* pFormField) { |
| for (int i = 0, sz = pFormField->CountControls(); i < sz; i++) { |
| CPDF_FormControl* pFormCtrl = pFormField->GetControl(i); |
| - ASSERT(pFormCtrl != NULL); |
| + ASSERT(pFormCtrl); |
| if (CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl)) { |
| CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); |
| @@ -1848,19 +1748,12 @@ void CPDFSDK_InterForm::UpdateField(CPDF_FormField* pFormField) { |
| void CPDFSDK_InterForm::OnKeyStrokeCommit(CPDF_FormField* pFormField, |
| CFX_WideString& csValue, |
| FX_BOOL& bRC) { |
| - ASSERT(pFormField != NULL); |
| - |
| CPDF_AAction aAction = pFormField->GetAdditionalAction(); |
| if (aAction && aAction.ActionExist(CPDF_AAction::KeyStroke)) { |
| CPDF_Action action = aAction.GetAction(CPDF_AAction::KeyStroke); |
| if (action) { |
| - ASSERT(m_pDocument != NULL); |
| CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); |
| - ASSERT(pEnv != NULL); |
| - |
| CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander(); |
| - ASSERT(pActionHandler != NULL); |
| - |
| PDFSDK_FieldAction fa; |
| fa.bModifier = pEnv->FFI_IsCTRLKeyDown(0); |
| fa.bShift = pEnv->FFI_IsSHIFTKeyDown(0); |
| @@ -1876,19 +1769,12 @@ void CPDFSDK_InterForm::OnKeyStrokeCommit(CPDF_FormField* pFormField, |
| void CPDFSDK_InterForm::OnValidate(CPDF_FormField* pFormField, |
| CFX_WideString& csValue, |
| FX_BOOL& bRC) { |
| - ASSERT(pFormField != NULL); |
| - |
| CPDF_AAction aAction = pFormField->GetAdditionalAction(); |
| if (aAction && aAction.ActionExist(CPDF_AAction::Validate)) { |
| CPDF_Action action = aAction.GetAction(CPDF_AAction::Validate); |
| if (action) { |
| - ASSERT(m_pDocument != NULL); |
| CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); |
| - ASSERT(pEnv != NULL); |
| - |
| CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander(); |
| - ASSERT(pActionHandler != NULL); |
| - |
| PDFSDK_FieldAction fa; |
| fa.bModifier = pEnv->FFI_IsCTRLKeyDown(0); |
| fa.bShift = pEnv->FFI_IsSHIFTKeyDown(0); |
| @@ -1901,8 +1787,6 @@ void CPDFSDK_InterForm::OnValidate(CPDF_FormField* pFormField, |
| } |
| } |
| -/* ----------------------------- action ----------------------------- */ |
| - |
| FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) { |
| ASSERT(action); |
| @@ -1937,7 +1821,6 @@ FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) { |
| } |
| FX_BOOL CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action) { |
| - ASSERT(m_pInterForm != NULL); |
| CFX_WideString sDestination = action.GetFilePath(); |
| if (sDestination.IsEmpty()) |
| return FALSE; |
| @@ -2050,15 +1933,11 @@ FX_BOOL CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination, |
| if (sDestination.IsEmpty()) |
| return FALSE; |
| - CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); |
| - ASSERT(pEnv != NULL); |
| - |
| - if (!m_pDocument) |
|
Lei Zhang
2015/12/12 02:11:15
Umm, this is a bit late?
|
| + if (!m_pDocument || !m_pInterForm) |
| return FALSE; |
| - CFX_WideString wsPDFFilePath = m_pDocument->GetPath(); |
| - if (!m_pInterForm) |
| - return FALSE; |
| + CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); |
| + CFX_WideString wsPDFFilePath = m_pDocument->GetPath(); |
| CFDF_Document* pFDFDoc = m_pInterForm->ExportToFDF(wsPDFFilePath); |
| if (!pFDFDoc) |
| return FALSE; |
| @@ -2088,9 +1967,6 @@ FX_BOOL CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination, |
| } |
| FX_BOOL CPDFSDK_InterForm::ExportFormToFDFTextBuf(CFX_ByteTextBuf& textBuf) { |
| - ASSERT(m_pInterForm != NULL); |
| - ASSERT(m_pDocument != NULL); |
| - |
| CFDF_Document* pFDF = m_pInterForm->ExportToFDF(m_pDocument->GetPath()); |
| if (!pFDF) |
| return FALSE; |
| @@ -2134,9 +2010,6 @@ std::vector<CPDF_FormField*> CPDFSDK_InterForm::GetFieldFromObjects( |
| return fields; |
| } |
| -/* ----------------------------- CPDF_FormNotify ----------------------------- |
| - */ |
| - |
| int CPDFSDK_InterForm::BeforeValueChange(const CPDF_FormField* pField, |
| CFX_WideString& csValue) { |
| CPDF_FormField* pFormField = (CPDF_FormField*)pField; |
| @@ -2274,12 +2147,7 @@ CBA_AnnotIterator::CBA_AnnotIterator(CPDFSDK_PageView* pPageView, |
| m_sType(sType), |
| m_sSubType(sSubType), |
| m_nTabs(BAI_STRUCTURE) { |
| - ASSERT(m_pPageView != NULL); |
| - |
| CPDF_Page* pPDFPage = m_pPageView->GetPDFPage(); |
| - ASSERT(pPDFPage != NULL); |
| - ASSERT(pPDFPage->m_pFormDict != NULL); |
| - |
| CFX_ByteString sTabs = pPDFPage->m_pFormDict->GetString("Tabs"); |
| if (sTabs == "R") { |
| @@ -2342,8 +2210,8 @@ int CBA_AnnotIterator::CompareByLeft(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2) { |
| } |
| int CBA_AnnotIterator::CompareByTop(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2) { |
| - ASSERT(p1 != NULL); |
| - ASSERT(p2 != NULL); |
| + ASSERT(p1); |
| + ASSERT(p2); |
| CPDF_Rect rcAnnot1 = GetAnnotRect(p1); |
| CPDF_Rect rcAnnot2 = GetAnnotRect(p2); |