diff options
author | Nico Weber <thakis@chromium.org> | 2015-08-04 12:19:10 -0700 |
---|---|---|
committer | Nico Weber <thakis@chromium.org> | 2015-08-04 12:19:10 -0700 |
commit | b048f791a15f2da781a01eba5b09eb9d389f9c11 (patch) | |
tree | 6850a73c18bbc41eaf4b1fdc6b3c96646d45587b /fpdfsdk/src/formfiller/FFL_CheckBox.cpp | |
parent | c8eeed31f217d99a706b0cbf5e4ce0bcc12beb64 (diff) | |
download | pdfium-b048f791a15f2da781a01eba5b09eb9d389f9c11.tar.xz |
clang-format all pdfium code.
No behavior change.
Generated by:
find . -name '*.cpp' -o -name '*.h' | \
grep -E -v 'third_party|thirdparties|lpng_v163' | \
xargs ../../buildtools/mac/clang-format -i
See thread "tabs vs spaces" on pdfium@googlegroups.com for discussion.
BUG=none
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1265503005 .
Diffstat (limited to 'fpdfsdk/src/formfiller/FFL_CheckBox.cpp')
-rw-r--r-- | fpdfsdk/src/formfiller/FFL_CheckBox.cpp | 213 |
1 files changed, 99 insertions, 114 deletions
diff --git a/fpdfsdk/src/formfiller/FFL_CheckBox.cpp b/fpdfsdk/src/formfiller/FFL_CheckBox.cpp index 55d2d45bc2..42c6251d68 100644 --- a/fpdfsdk/src/formfiller/FFL_CheckBox.cpp +++ b/fpdfsdk/src/formfiller/FFL_CheckBox.cpp @@ -8,137 +8,122 @@ #include "../../include/formfiller/FFL_FormFiller.h" #include "../../include/formfiller/FFL_CheckBox.h" +/* ------------------------------- CFFL_CheckBox ------------------------------- + */ -/* ------------------------------- CFFL_CheckBox ------------------------------- */ +CFFL_CheckBox::CFFL_CheckBox(CPDFDoc_Environment* pApp, CPDFSDK_Widget* pWidget) + : CFFL_Button(pApp, pWidget) {} -CFFL_CheckBox::CFFL_CheckBox(CPDFDoc_Environment* pApp, CPDFSDK_Widget* pWidget) : - CFFL_Button(pApp, pWidget) -{ -} - -CFFL_CheckBox::~CFFL_CheckBox() -{ -} +CFFL_CheckBox::~CFFL_CheckBox() {} -CPWL_Wnd* CFFL_CheckBox::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView) -{ - CPWL_CheckBox* pWnd = new CPWL_CheckBox(); - pWnd->Create(cp); +CPWL_Wnd* CFFL_CheckBox::NewPDFWindow(const PWL_CREATEPARAM& cp, + CPDFSDK_PageView* pPageView) { + CPWL_CheckBox* pWnd = new CPWL_CheckBox(); + pWnd->Create(cp); - ASSERT(m_pWidget != NULL); - pWnd->SetCheck(m_pWidget->IsChecked()); + ASSERT(m_pWidget != NULL); + pWnd->SetCheck(m_pWidget->IsChecked()); - return pWnd; + return pWnd; } -FX_BOOL CFFL_CheckBox::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_UINT nFlags) -{ - switch (nKeyCode) - { - case FWL_VKEY_Return: - case FWL_VKEY_Space: - return TRUE; - default: - return CFFL_FormFiller::OnKeyDown(pAnnot, nKeyCode, nFlags); - } +FX_BOOL CFFL_CheckBox::OnKeyDown(CPDFSDK_Annot* pAnnot, + FX_UINT nKeyCode, + FX_UINT nFlags) { + switch (nKeyCode) { + case FWL_VKEY_Return: + case FWL_VKEY_Space: + return TRUE; + default: + return CFFL_FormFiller::OnKeyDown(pAnnot, nKeyCode, nFlags); + } } -FX_BOOL CFFL_CheckBox::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags) -{ - switch (nChar) - { - case FWL_VKEY_Return: - case FWL_VKEY_Space: - { - CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller(); - ASSERT(pIFormFiller != NULL); - - CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); - ASSERT(pPageView != NULL); - - FX_BOOL bReset = FALSE; - FX_BOOL bExit = FALSE; - - pIFormFiller->OnButtonUp(m_pWidget, pPageView, bReset, bExit,nFlags); - - if (bReset) return TRUE; - if (bExit) return TRUE; - - CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); - - if (CPWL_CheckBox * pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, TRUE)) - pWnd->SetCheck(!pWnd->IsChecked()); - - CommitData(pPageView,nFlags); - return TRUE; - } - default: - return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); - } +FX_BOOL CFFL_CheckBox::OnChar(CPDFSDK_Annot* pAnnot, + FX_UINT nChar, + FX_UINT nFlags) { + switch (nChar) { + case FWL_VKEY_Return: + case FWL_VKEY_Space: { + CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller(); + ASSERT(pIFormFiller != NULL); + + CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); + ASSERT(pPageView != NULL); + + FX_BOOL bReset = FALSE; + FX_BOOL bExit = FALSE; + + pIFormFiller->OnButtonUp(m_pWidget, pPageView, bReset, bExit, nFlags); + + if (bReset) + return TRUE; + if (bExit) + return TRUE; + + CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); + + if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, TRUE)) + pWnd->SetCheck(!pWnd->IsChecked()); + + CommitData(pPageView, nFlags); + return TRUE; + } + default: + return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); + } } -FX_BOOL CFFL_CheckBox::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) -{ - CFFL_Button::OnLButtonUp(pPageView, pAnnot, nFlags, point); +FX_BOOL CFFL_CheckBox::OnLButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + FX_UINT nFlags, + const CPDF_Point& point) { + CFFL_Button::OnLButtonUp(pPageView, pAnnot, nFlags, point); - if (IsValid()) - { - if (CPWL_CheckBox * pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, TRUE)) - { - CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; - pWnd->SetCheck(!pWidget->IsChecked()); - // pWnd->SetCheck(!pWnd->IsChecked()); - } + if (IsValid()) { + if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, TRUE)) { + CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; + pWnd->SetCheck(!pWidget->IsChecked()); + // pWnd->SetCheck(!pWnd->IsChecked()); + } - if (!CommitData(pPageView, nFlags)) return FALSE; - } + if (!CommitData(pPageView, nFlags)) + return FALSE; + } - return TRUE; + return TRUE; } -FX_BOOL CFFL_CheckBox::IsDataChanged(CPDFSDK_PageView* pPageView) -{ +FX_BOOL CFFL_CheckBox::IsDataChanged(CPDFSDK_PageView* pPageView) { + ASSERT(m_pWidget != NULL); - ASSERT(m_pWidget != NULL); + if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, FALSE)) { + return pWnd->IsChecked() != m_pWidget->IsChecked(); + } - if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, FALSE)) - { - return pWnd->IsChecked() != m_pWidget->IsChecked(); - } - - return FALSE; + return FALSE; } -void CFFL_CheckBox::SaveData(CPDFSDK_PageView* pPageView) -{ - - ASSERT(m_pWidget != NULL); - - if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, FALSE)) - { - - FX_BOOL bNewChecked = pWnd->IsChecked(); - - - if (bNewChecked) - { - CPDF_FormField* pField = m_pWidget->GetFormField(); - ASSERT(pField != NULL); - - for (int32_t i=0,sz=pField->CountControls(); i<sz; i++) - { - if (CPDF_FormControl* pCtrl = pField->GetControl(i)) - { - if (pCtrl->IsChecked()) - { - break; - } - } - } - } - - m_pWidget->SetCheck(bNewChecked, FALSE); - m_pWidget->UpdateField(); - SetChangeMark(); - } - +void CFFL_CheckBox::SaveData(CPDFSDK_PageView* pPageView) { + ASSERT(m_pWidget != NULL); + + if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, FALSE)) { + FX_BOOL bNewChecked = pWnd->IsChecked(); + + if (bNewChecked) { + CPDF_FormField* pField = m_pWidget->GetFormField(); + ASSERT(pField != NULL); + + for (int32_t i = 0, sz = pField->CountControls(); i < sz; i++) { + if (CPDF_FormControl* pCtrl = pField->GetControl(i)) { + if (pCtrl->IsChecked()) { + break; + } + } + } + } + + m_pWidget->SetCheck(bNewChecked, FALSE); + m_pWidget->UpdateField(); + SetChangeMark(); + } } |