Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Side by Side Diff: fpdfsdk/src/formfiller/FFL_RadioButton.cpp

Issue 453133004: clang-format all code (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "../../include/formfiller/FormFiller.h" 7 #include "../../include/formfiller/FormFiller.h"
8 #include "../../include/formfiller/FFL_FormFiller.h" 8 #include "../../include/formfiller/FFL_FormFiller.h"
9 #include "../../include/formfiller/FFL_RadioButton.h" 9 #include "../../include/formfiller/FFL_RadioButton.h"
10 //#include "../include/FFL_Undo.h" 10 //#include "../include/FFL_Undo.h"
11 11
12 /* ------------------------------- CFFL_RadioButton ---------------------------- --- */ 12 /* ------------------------------- CFFL_RadioButton
13 * ------------------------------- */
13 14
14 CFFL_RadioButton::CFFL_RadioButton(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWi dget) : 15 CFFL_RadioButton::CFFL_RadioButton(CPDFDoc_Environment* pApp,
15 » CFFL_Button(pApp, pWidget) 16 CPDFSDK_Annot* pWidget)
16 { 17 : CFFL_Button(pApp, pWidget) {
17 } 18 }
18 19
19 CFFL_RadioButton::~CFFL_RadioButton() 20 CFFL_RadioButton::~CFFL_RadioButton() {
20 {
21 } 21 }
22 22
23 CPWL_Wnd* CFFL_RadioButton::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_Page View* pPageView) 23 CPWL_Wnd* CFFL_RadioButton::NewPDFWindow(const PWL_CREATEPARAM& cp,
24 { 24 CPDFSDK_PageView* pPageView) {
25 » CPWL_RadioButton* pWnd = new CPWL_RadioButton(); 25 CPWL_RadioButton* pWnd = new CPWL_RadioButton();
26 » pWnd->Create(cp); 26 pWnd->Create(cp);
27 27
28 » ASSERT(m_pWidget != NULL); 28 ASSERT(m_pWidget != NULL);
29 » pWnd->SetCheck(m_pWidget->IsChecked()); 29 pWnd->SetCheck(m_pWidget->IsChecked());
30 » 30
31 » return pWnd; 31 return pWnd;
32 } 32 }
33 33
34 FX_BOOL»CFFL_RadioButton::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_ UINT nFlags) 34 FX_BOOL CFFL_RadioButton::OnKeyDown(CPDFSDK_Annot* pAnnot,
35 { 35 FX_UINT nKeyCode,
36 » switch (nKeyCode) 36 FX_UINT nFlags) {
37 » { 37 switch (nKeyCode) {
38 » case FWL_VKEY_Return: 38 case FWL_VKEY_Return:
39 » case FWL_VKEY_Space: 39 case FWL_VKEY_Space:
40 » » return TRUE; 40 return TRUE;
41 » default: 41 default:
42 » » return CFFL_FormFiller::OnKeyDown(pAnnot, nKeyCode, nFlags); 42 return CFFL_FormFiller::OnKeyDown(pAnnot, nKeyCode, nFlags);
43 » } 43 }
44 } 44 }
45 45
46 FX_BOOL»CFFL_RadioButton::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT n Flags) 46 FX_BOOL CFFL_RadioButton::OnChar(CPDFSDK_Annot* pAnnot,
47 { 47 FX_UINT nChar,
48 » switch (nChar) 48 FX_UINT nFlags) {
49 » { 49 switch (nChar) {
50 » case FWL_VKEY_Return:» 50 case FWL_VKEY_Return:
51 » case FWL_VKEY_Space: 51 case FWL_VKEY_Space: {
52 » » { 52 CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller();
53 » » » CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller( ); 53 ASSERT(pIFormFiller != NULL);
54 » » » ASSERT(pIFormFiller != NULL);
55 54
56 » » » CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); 55 CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
57 » » » ASSERT(pPageView != NULL); 56 ASSERT(pPageView != NULL);
58 57
59 » » » FX_BOOL bReset = FALSE; 58 FX_BOOL bReset = FALSE;
60 » » » FX_BOOL bExit = FALSE; 59 FX_BOOL bExit = FALSE;
61 60
62 » » » pIFormFiller->OnButtonUp(m_pWidget, pPageView, bReset, b Exit,nFlags); 61 pIFormFiller->OnButtonUp(m_pWidget, pPageView, bReset, bExit, nFlags);
63 62
64 » » » if (bReset) return TRUE; 63 if (bReset)
65 » » » if (bExit) return TRUE; 64 return TRUE;
65 if (bExit)
66 return TRUE;
66 67
67 » » » CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); 68 CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags);
68 69
69 » » » if (CPWL_RadioButton * pWnd = (CPWL_RadioButton*)GetPDFW indow(pPageView, TRUE)) 70 if (CPWL_RadioButton* pWnd =
70 » » » » pWnd->SetCheck(TRUE); 71 (CPWL_RadioButton*)GetPDFWindow(pPageView, TRUE))
71 » » » CommitData(pPageView,nFlags); 72 pWnd->SetCheck(TRUE);
72 » » » return TRUE; 73 CommitData(pPageView, nFlags);
73 » » } 74 return TRUE;
74 » default: 75 }
75 » » return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); 76 default:
76 » } 77 return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags);
78 }
77 } 79 }
78 80
79 FX_BOOL»CFFL_RadioButton::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot * pAnnot, FX_UINT nFlags, const CPDF_Point& point) 81 FX_BOOL CFFL_RadioButton::OnLButtonUp(CPDFSDK_PageView* pPageView,
80 { 82 CPDFSDK_Annot* pAnnot,
81 » CFFL_Button::OnLButtonUp(pPageView, pAnnot, nFlags, point); 83 FX_UINT nFlags,
84 const CPDF_Point& point) {
85 CFFL_Button::OnLButtonUp(pPageView, pAnnot, nFlags, point);
82 86
83 » if (IsValid()) 87 if (IsValid()) {
84 » { 88 if (CPWL_RadioButton* pWnd =
85 » » if (CPWL_RadioButton * pWnd = (CPWL_RadioButton*)GetPDFWindow(pP ageView, TRUE)) 89 (CPWL_RadioButton*)GetPDFWindow(pPageView, TRUE))
86 » » » pWnd->SetCheck(TRUE); 90 pWnd->SetCheck(TRUE);
87 91
88 » » if (!CommitData(pPageView,nFlags)) return FALSE; 92 if (!CommitData(pPageView, nFlags))
89 » } 93 return FALSE;
94 }
90 95
91 » return TRUE; 96 return TRUE;
92 } 97 }
93 98
94 FX_BOOL»CFFL_RadioButton::IsDataChanged(CPDFSDK_PageView* pPageView) 99 FX_BOOL CFFL_RadioButton::IsDataChanged(CPDFSDK_PageView* pPageView) {
95 { 100 ASSERT(m_pWidget != NULL);
96 » ASSERT(m_pWidget != NULL);
97 101
98 » if (CPWL_RadioButton* pWnd = (CPWL_RadioButton*)GetPDFWindow(pPageView, FALSE)) 102 if (CPWL_RadioButton* pWnd =
99 » { 103 (CPWL_RadioButton*)GetPDFWindow(pPageView, FALSE)) {
100 » » return pWnd->IsChecked() != m_pWidget->IsChecked(); 104 return pWnd->IsChecked() != m_pWidget->IsChecked();
101 » } 105 }
102 106
103 » return FALSE; 107 return FALSE;
104 } 108 }
105 109
106 void CFFL_RadioButton::SaveData(CPDFSDK_PageView* pPageView) 110 void CFFL_RadioButton::SaveData(CPDFSDK_PageView* pPageView) {
107 { 111 ASSERT(m_pWidget != NULL);
108 » ASSERT(m_pWidget != NULL);
109 112
110 » if (CPWL_RadioButton* pWnd = (CPWL_RadioButton*)GetPDFWindow(pPageView, FALSE)) 113 if (CPWL_RadioButton* pWnd =
111 » { 114 (CPWL_RadioButton*)GetPDFWindow(pPageView, FALSE)) {
112 » » 115 FX_BOOL bNewChecked = pWnd->IsChecked();
113 » » FX_BOOL bNewChecked = pWnd->IsChecked();
114 116
115 » » if (bNewChecked) 117 if (bNewChecked) {
116 » » { 118 CPDF_FormField* pField = m_pWidget->GetFormField();
117 » » » CPDF_FormField* pField = m_pWidget->GetFormField(); 119 ASSERT(pField != NULL);
118 » » » ASSERT(pField != NULL);
119 120
120 » » » for (FX_INT32 i=0,sz=pField->CountControls(); i<sz; i++) 121 for (FX_INT32 i = 0, sz = pField->CountControls(); i < sz; i++) {
121 » » » { 122 if (CPDF_FormControl* pCtrl = pField->GetControl(i)) {
122 » » » » if (CPDF_FormControl* pCtrl = pField->GetControl (i)) 123 if (pCtrl->IsChecked()) {
123 » » » » { 124 break;
124 » » » » » if (pCtrl->IsChecked()) 125 }
125 » » » » » { 126 }
126 » » » » » » break; 127 }
127 » » » » » } 128 }
128 » » » » }
129 » » » }
130 » » }
131 129
132 » » m_pWidget->SetCheck(bNewChecked, FALSE); 130 m_pWidget->SetCheck(bNewChecked, FALSE);
133 » » m_pWidget->UpdateField(); 131 m_pWidget->UpdateField();
134 » » SetChangeMark(); 132 SetChangeMark();
135 » } 133 }
136 } 134 }
137
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698