| OLD | NEW |
| 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_Notify.h" | 9 #include "../../include/formfiller/FFL_Notify.h" |
| 10 // #include "../../include/formfiller/FFL_ComboBox.h" | 10 // #include "../../include/formfiller/FFL_ComboBox.h" |
| 11 // #include "../../include/formfiller/FFL_Module.h" | 11 // #include "../../include/formfiller/FFL_Module.h" |
| 12 | 12 |
| 13 /* -------------------------------- CFFL_Notify ------------------------------ *
/ | 13 /* -------------------------------- CFFL_Notify ------------------------------ |
| 14 */ |
| 14 | 15 |
| 15 //#pragma warning(disable: 4800) | 16 //#pragma warning(disable: 4800) |
| 16 | 17 |
| 17 CFFL_Notify::CFFL_Notify(CFFL_FormFiller * pFormFiller) : | 18 CFFL_Notify::CFFL_Notify(CFFL_FormFiller* pFormFiller) |
| 18 » m_bDoActioning(FALSE), | 19 : m_bDoActioning(FALSE), m_nNotifyFlag(0) { |
| 19 » m_nNotifyFlag(0) | 20 ASSERT(pFormFiller != NULL); |
| 20 { | |
| 21 » ASSERT(pFormFiller != NULL); | |
| 22 } | 21 } |
| 23 | 22 |
| 24 CFFL_Notify::~CFFL_Notify() | 23 CFFL_Notify::~CFFL_Notify() { |
| 25 { | |
| 26 } | 24 } |
| 27 | 25 |
| 28 void CFFL_Notify::BeforeNotify() | 26 void CFFL_Notify::BeforeNotify() { |
| 29 { | 27 m_nNotifyFlag++; |
| 30 » m_nNotifyFlag ++; | |
| 31 } | 28 } |
| 32 | 29 |
| 33 | 30 void CFFL_Notify::AfterNotify() { |
| 34 void CFFL_Notify::AfterNotify() | 31 m_nNotifyFlag--; |
| 35 { | |
| 36 » m_nNotifyFlag --; | |
| 37 } | 32 } |
| 38 | 33 |
| 39 FX_BOOL CFFL_Notify::OnMouseUp(FX_BOOL & bExit) | 34 FX_BOOL CFFL_Notify::OnMouseUp(FX_BOOL& bExit) { |
| 40 { | 35 BeforeNotify(); |
| 41 » BeforeNotify(); | 36 FX_BOOL bRet = |
| 42 » FX_BOOL bRet = FALSE;//DoAAction(CPDF_AAction::AActionType::ButtonUp, bE
xit); | 37 FALSE; // DoAAction(CPDF_AAction::AActionType::ButtonUp, bExit); |
| 43 » AfterNotify(); | 38 AfterNotify(); |
| 44 » return bRet; | 39 return bRet; |
| 45 } | 40 } |
| 46 | 41 |
| 47 FX_BOOL CFFL_Notify::OnMouseDown(FX_BOOL & bExit) | 42 FX_BOOL CFFL_Notify::OnMouseDown(FX_BOOL& bExit) { |
| 48 { | 43 BeforeNotify(); |
| 49 » BeforeNotify(); | 44 FX_BOOL bRet = |
| 50 » FX_BOOL bRet = FALSE;//DoAAction(CPDF_AAction::AActionType::ButtonDown,
bExit); | 45 FALSE; // DoAAction(CPDF_AAction::AActionType::ButtonDown, bExit); |
| 51 » AfterNotify(); | 46 AfterNotify(); |
| 52 » return bRet; | 47 return bRet; |
| 53 } | 48 } |
| 54 | 49 |
| 55 FX_BOOL CFFL_Notify::OnMouseEnter(FX_BOOL & bExit) | 50 FX_BOOL CFFL_Notify::OnMouseEnter(FX_BOOL& bExit) { |
| 56 { | 51 BeforeNotify(); |
| 57 » BeforeNotify(); | 52 FX_BOOL bRet = |
| 58 » FX_BOOL bRet = FALSE;//DoAAction(CPDF_AAction::AActionType::CursorEnter,
bExit); | 53 FALSE; // DoAAction(CPDF_AAction::AActionType::CursorEnter, bExit); |
| 59 » AfterNotify(); | 54 AfterNotify(); |
| 60 » return bRet; | 55 return bRet; |
| 61 } | 56 } |
| 62 | 57 |
| 63 FX_BOOL CFFL_Notify::OnMouseExit(FX_BOOL & bExit) | 58 FX_BOOL CFFL_Notify::OnMouseExit(FX_BOOL& bExit) { |
| 64 { | 59 BeforeNotify(); |
| 65 » BeforeNotify(); | 60 FX_BOOL bRet = |
| 66 » FX_BOOL bRet = FALSE;//DoAAction(CPDF_AAction::AActionType::CursorExit,
bExit); | 61 FALSE; // DoAAction(CPDF_AAction::AActionType::CursorExit, bExit); |
| 67 » AfterNotify(); | 62 AfterNotify(); |
| 68 » return bRet; | 63 return bRet; |
| 69 } | 64 } |
| 70 | 65 |
| 71 FX_BOOL CFFL_Notify::OnSetFocus(FX_BOOL & bExit) | 66 FX_BOOL CFFL_Notify::OnSetFocus(FX_BOOL& bExit) { |
| 72 { | 67 BeforeNotify(); |
| 73 » BeforeNotify(); | 68 FX_BOOL bRet = |
| 74 » FX_BOOL bRet = FALSE;//DoAAction(CPDF_AAction::AActionType::GetFocus, bE
xit); | 69 FALSE; // DoAAction(CPDF_AAction::AActionType::GetFocus, bExit); |
| 75 » AfterNotify(); | 70 AfterNotify(); |
| 76 » return bRet; | 71 return bRet; |
| 77 } | 72 } |
| 78 | 73 |
| 79 FX_BOOL CFFL_Notify::OnKillFocus(FX_BOOL & bExit) | 74 FX_BOOL CFFL_Notify::OnKillFocus(FX_BOOL& bExit) { |
| 80 { | 75 BeforeNotify(); |
| 81 » BeforeNotify(); | 76 FX_BOOL bRet = |
| 82 » FX_BOOL bRet = FALSE;//DoAAction(CPDF_AAction::AActionType::LoseFocus, b
Exit); | 77 FALSE; // DoAAction(CPDF_AAction::AActionType::LoseFocus, bExit); |
| 83 » AfterNotify(); | 78 AfterNotify(); |
| 84 » return bRet; | 79 return bRet; |
| 85 } | 80 } |
| 86 | 81 |
| 87 FX_BOOL CFFL_Notify::OnCalculate() | 82 FX_BOOL CFFL_Notify::OnCalculate() { |
| 88 { | 83 return TRUE; |
| 89 » return TRUE; | |
| 90 } | 84 } |
| 91 | 85 |
| 92 FX_BOOL CFFL_Notify::OnFormat(int iCommitKey) | 86 FX_BOOL CFFL_Notify::OnFormat(int iCommitKey) { |
| 93 { | 87 return TRUE; |
| 94 » return TRUE; | |
| 95 } | 88 } |
| 96 | 89 |
| 97 FX_BOOL CFFL_Notify::OnKeyStroke(CPDF_FormField* pFormField, int nCommitKey, CFX
_WideString& strValue, CFX_WideString& strChange, | 90 FX_BOOL CFFL_Notify::OnKeyStroke(CPDF_FormField* pFormField, |
| 98 » » » » » » » const CFX_WideString&
strChangeEx, FX_BOOL bKeyDown, FX_BOOL bModifier, | 91 int nCommitKey, |
| 99 » » » » » » » FX_BOOL bShift, FX_BO
OL bWillCommit, FX_BOOL bFieldFull, | 92 CFX_WideString& strValue, |
| 100 » » » » » » » int& nSelStart, int&
nSelEnd, FX_BOOL& bRC) | 93 CFX_WideString& strChange, |
| 101 { | 94 const CFX_WideString& strChangeEx, |
| 102 » return TRUE; | 95 FX_BOOL bKeyDown, |
| 96 FX_BOOL bModifier, |
| 97 FX_BOOL bShift, |
| 98 FX_BOOL bWillCommit, |
| 99 FX_BOOL bFieldFull, |
| 100 int& nSelStart, |
| 101 int& nSelEnd, |
| 102 FX_BOOL& bRC) { |
| 103 return TRUE; |
| 103 } | 104 } |
| 104 | 105 |
| 105 FX_BOOL CFFL_Notify::OnValidate(CPDF_FormField* pFormField, CFX_WideString& strV
alue, CFX_WideString & strChange, | 106 FX_BOOL CFFL_Notify::OnValidate(CPDF_FormField* pFormField, |
| 106 » » » » » » » » » const
CFX_WideString& strChangeEx, FX_BOOL bKeyDown, FX_BOOL bModifier, | 107 CFX_WideString& strValue, |
| 107 » » » » » » » » » FX_BO
OL bShift, FX_BOOL & bRC) | 108 CFX_WideString& strChange, |
| 108 { | 109 const CFX_WideString& strChangeEx, |
| 109 » return TRUE; | 110 FX_BOOL bKeyDown, |
| 111 FX_BOOL bModifier, |
| 112 FX_BOOL bShift, |
| 113 FX_BOOL& bRC) { |
| 114 return TRUE; |
| 110 } | 115 } |
| 111 | 116 |
| 112 FX_BOOL»CFFL_Notify::DoAAction(CPDF_AAction::AActionType eAAT, FX_BOOL & bExit) | 117 FX_BOOL CFFL_Notify::DoAAction(CPDF_AAction::AActionType eAAT, FX_BOOL& bExit) { |
| 113 { | 118 if (this->m_bDoActioning) |
| 114 » if (this->m_bDoActioning) return FALSE; | 119 return FALSE; |
| 115 » | |
| 116 » CPDF_Action action; | |
| 117 » if (!FindAAction(eAAT,action)) return FALSE; | |
| 118 | 120 |
| 119 » this->m_bDoActioning = TRUE;» | 121 CPDF_Action action; |
| 120 » ExecuteActionTree(eAAT,action,bExit);» | 122 if (!FindAAction(eAAT, action)) |
| 121 » this->m_bDoActioning = FALSE; | 123 return FALSE; |
| 122 » return TRUE; | 124 |
| 125 this->m_bDoActioning = TRUE; |
| 126 ExecuteActionTree(eAAT, action, bExit); |
| 127 this->m_bDoActioning = FALSE; |
| 128 return TRUE; |
| 123 } | 129 } |
| 124 | 130 |
| 125 FX_BOOL»CFFL_Notify::ExecuteActionTree(CPDF_AAction::AActionType eAAT,CPDF_Actio
n & action, FX_BOOL& bExit) | 131 FX_BOOL CFFL_Notify::ExecuteActionTree(CPDF_AAction::AActionType eAAT, |
| 126 { | 132 CPDF_Action& action, |
| 127 » if (!ExecuteAction(eAAT,action,bExit)) return FALSE; | 133 FX_BOOL& bExit) { |
| 128 » if (bExit) return TRUE; | 134 if (!ExecuteAction(eAAT, action, bExit)) |
| 135 return FALSE; |
| 136 if (bExit) |
| 137 return TRUE; |
| 129 | 138 |
| 130 » for (FX_INT32 i=0,sz=action.GetSubActionsCount(); i<sz; i++) | 139 for (FX_INT32 i = 0, sz = action.GetSubActionsCount(); i < sz; i++) { |
| 131 » { | 140 CPDF_Action subaction = action.GetSubAction(i); |
| 132 » » CPDF_Action subaction = action.GetSubAction(i); | 141 if (!ExecuteActionTree(eAAT, subaction, bExit)) |
| 133 » » if (!ExecuteActionTree(eAAT,subaction,bExit)) return FALSE; | 142 return FALSE; |
| 134 » » if (bExit) break; | 143 if (bExit) |
| 135 » } | 144 break; |
| 145 } |
| 136 | 146 |
| 137 » return TRUE; | 147 return TRUE; |
| 138 } | 148 } |
| 139 | 149 |
| 140 | 150 FX_BOOL CFFL_Notify::FindAAction(CPDF_AAction::AActionType eAAT, |
| 141 FX_BOOL»CFFL_Notify::FindAAction(CPDF_AAction::AActionType eAAT,CPDF_Action & ac
tion) | 151 CPDF_Action& action) { |
| 142 { | 152 return FALSE; |
| 143 » return FALSE; | |
| 144 } | 153 } |
| 145 | 154 |
| 146 FX_BOOL CFFL_Notify::FindAAction(CPDF_AAction aaction,CPDF_AAction::AActionType
eAAT,CPDF_Action & action) | 155 FX_BOOL CFFL_Notify::FindAAction(CPDF_AAction aaction, |
| 147 { | 156 CPDF_AAction::AActionType eAAT, |
| 148 » CPDF_Action MyAction; | 157 CPDF_Action& action) { |
| 158 CPDF_Action MyAction; |
| 149 | 159 |
| 150 » if (aaction.ActionExist(eAAT)) | 160 if (aaction.ActionExist(eAAT)) { |
| 151 » { | 161 MyAction = aaction.GetAction(eAAT); |
| 152 » » MyAction = aaction.GetAction(eAAT); | 162 } else |
| 153 » } | 163 return FALSE; |
| 154 » else | |
| 155 » » return FALSE; | |
| 156 | 164 |
| 165 if (MyAction.GetType() == CPDF_Action::Unknown) |
| 166 return FALSE; |
| 157 | 167 |
| 158 » if (MyAction.GetType() == CPDF_Action::Unknown) | 168 action = MyAction; |
| 159 » » return FALSE; | |
| 160 | 169 |
| 161 » action = MyAction; | 170 return TRUE; |
| 162 | |
| 163 » return TRUE; | |
| 164 } | 171 } |
| 165 | 172 |
| 166 FX_BOOL»CFFL_Notify::ExecuteAction(CPDF_AAction::AActionType eAAT,CPDF_Action &
action,FX_BOOL& bExit) | 173 FX_BOOL CFFL_Notify::ExecuteAction(CPDF_AAction::AActionType eAAT, |
| 167 { | 174 CPDF_Action& action, |
| 168 » return FALSE; | 175 FX_BOOL& bExit) { |
| 176 return FALSE; |
| 169 } | 177 } |
| 170 //#pragma warning(default: 4800) | 178 //#pragma warning(default: 4800) |
| 171 | |
| OLD | NEW |