OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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 "fpdfsdk/cpdfsdk_baannothandler.h" | 7 #include "fpdfsdk/cpdfsdk_baannothandler.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <vector> | 10 #include <vector> |
(...skipping 19 matching lines...) Expand all Loading... |
30 rects.push_back(pPopupAnnot->GetRect()); | 30 rects.push_back(pPopupAnnot->GetRect()); |
31 pPageView->UpdateRects(rects); | 31 pPageView->UpdateRects(rects); |
32 } | 32 } |
33 | 33 |
34 } // namespace | 34 } // namespace |
35 | 35 |
36 CPDFSDK_BAAnnotHandler::CPDFSDK_BAAnnotHandler() {} | 36 CPDFSDK_BAAnnotHandler::CPDFSDK_BAAnnotHandler() {} |
37 | 37 |
38 CPDFSDK_BAAnnotHandler::~CPDFSDK_BAAnnotHandler() {} | 38 CPDFSDK_BAAnnotHandler::~CPDFSDK_BAAnnotHandler() {} |
39 | 39 |
40 FX_BOOL CPDFSDK_BAAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { | 40 bool CPDFSDK_BAAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { |
41 return FALSE; | 41 return false; |
42 } | 42 } |
43 | 43 |
44 CPDFSDK_Annot* CPDFSDK_BAAnnotHandler::NewAnnot(CPDF_Annot* pAnnot, | 44 CPDFSDK_Annot* CPDFSDK_BAAnnotHandler::NewAnnot(CPDF_Annot* pAnnot, |
45 CPDFSDK_PageView* pPage) { | 45 CPDFSDK_PageView* pPage) { |
46 return new CPDFSDK_BAAnnot(pAnnot, pPage); | 46 return new CPDFSDK_BAAnnot(pAnnot, pPage); |
47 } | 47 } |
48 | 48 |
49 #ifdef PDF_ENABLE_XFA | 49 #ifdef PDF_ENABLE_XFA |
50 CPDFSDK_Annot* CPDFSDK_BAAnnotHandler::NewAnnot(CXFA_FFWidget* hWidget, | 50 CPDFSDK_Annot* CPDFSDK_BAAnnotHandler::NewAnnot(CXFA_FFWidget* hWidget, |
51 CPDFSDK_PageView* pPage) { | 51 CPDFSDK_PageView* pPage) { |
(...skipping 29 matching lines...) Expand all Loading... |
81 } | 81 } |
82 | 82 |
83 void CPDFSDK_BAAnnotHandler::OnMouseExit(CPDFSDK_PageView* pPageView, | 83 void CPDFSDK_BAAnnotHandler::OnMouseExit(CPDFSDK_PageView* pPageView, |
84 CPDFSDK_Annot::ObservedPtr* pAnnot, | 84 CPDFSDK_Annot::ObservedPtr* pAnnot, |
85 uint32_t nFlag) { | 85 uint32_t nFlag) { |
86 CPDFSDK_BAAnnot* pBAAnnot = static_cast<CPDFSDK_BAAnnot*>(pAnnot->Get()); | 86 CPDFSDK_BAAnnot* pBAAnnot = static_cast<CPDFSDK_BAAnnot*>(pAnnot->Get()); |
87 pBAAnnot->SetOpenState(false); | 87 pBAAnnot->SetOpenState(false); |
88 UpdateAnnotRects(pPageView, pBAAnnot); | 88 UpdateAnnotRects(pPageView, pBAAnnot); |
89 } | 89 } |
90 | 90 |
91 FX_BOOL CPDFSDK_BAAnnotHandler::OnLButtonDown( | 91 bool CPDFSDK_BAAnnotHandler::OnLButtonDown(CPDFSDK_PageView* pPageView, |
92 CPDFSDK_PageView* pPageView, | 92 CPDFSDK_Annot::ObservedPtr* pAnnot, |
93 CPDFSDK_Annot::ObservedPtr* pAnnot, | 93 uint32_t nFlags, |
94 uint32_t nFlags, | 94 const CFX_FloatPoint& point) { |
95 const CFX_FloatPoint& point) { | 95 return false; |
96 return FALSE; | |
97 } | 96 } |
98 | 97 |
99 FX_BOOL CPDFSDK_BAAnnotHandler::OnLButtonUp(CPDFSDK_PageView* pPageView, | 98 bool CPDFSDK_BAAnnotHandler::OnLButtonUp(CPDFSDK_PageView* pPageView, |
100 CPDFSDK_Annot::ObservedPtr* pAnnot, | 99 CPDFSDK_Annot::ObservedPtr* pAnnot, |
101 uint32_t nFlags, | 100 uint32_t nFlags, |
102 const CFX_FloatPoint& point) { | 101 const CFX_FloatPoint& point) { |
103 return FALSE; | 102 return false; |
104 } | 103 } |
105 | 104 |
106 FX_BOOL CPDFSDK_BAAnnotHandler::OnLButtonDblClk( | 105 bool CPDFSDK_BAAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView, |
107 CPDFSDK_PageView* pPageView, | 106 CPDFSDK_Annot::ObservedPtr* pAnnot, |
108 CPDFSDK_Annot::ObservedPtr* pAnnot, | 107 uint32_t nFlags, |
109 uint32_t nFlags, | 108 const CFX_FloatPoint& point) { |
110 const CFX_FloatPoint& point) { | 109 return false; |
111 return FALSE; | |
112 } | 110 } |
113 | 111 |
114 FX_BOOL CPDFSDK_BAAnnotHandler::OnMouseMove(CPDFSDK_PageView* pPageView, | 112 bool CPDFSDK_BAAnnotHandler::OnMouseMove(CPDFSDK_PageView* pPageView, |
115 CPDFSDK_Annot::ObservedPtr* pAnnot, | 113 CPDFSDK_Annot::ObservedPtr* pAnnot, |
116 uint32_t nFlags, | 114 uint32_t nFlags, |
117 const CFX_FloatPoint& point) { | 115 const CFX_FloatPoint& point) { |
118 return FALSE; | 116 return false; |
119 } | 117 } |
120 | 118 |
121 FX_BOOL CPDFSDK_BAAnnotHandler::OnMouseWheel(CPDFSDK_PageView* pPageView, | 119 bool CPDFSDK_BAAnnotHandler::OnMouseWheel(CPDFSDK_PageView* pPageView, |
| 120 CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 121 uint32_t nFlags, |
| 122 short zDelta, |
| 123 const CFX_FloatPoint& point) { |
| 124 return false; |
| 125 } |
| 126 |
| 127 bool CPDFSDK_BAAnnotHandler::OnRButtonDown(CPDFSDK_PageView* pPageView, |
| 128 CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 129 uint32_t nFlags, |
| 130 const CFX_FloatPoint& point) { |
| 131 return false; |
| 132 } |
| 133 |
| 134 bool CPDFSDK_BAAnnotHandler::OnRButtonUp(CPDFSDK_PageView* pPageView, |
| 135 CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 136 uint32_t nFlags, |
| 137 const CFX_FloatPoint& point) { |
| 138 return false; |
| 139 } |
| 140 |
| 141 bool CPDFSDK_BAAnnotHandler::OnRButtonDblClk(CPDFSDK_PageView* pPageView, |
122 CPDFSDK_Annot::ObservedPtr* pAnnot, | 142 CPDFSDK_Annot::ObservedPtr* pAnnot, |
123 uint32_t nFlags, | 143 uint32_t nFlags, |
124 short zDelta, | |
125 const CFX_FloatPoint& point) { | 144 const CFX_FloatPoint& point) { |
126 return FALSE; | 145 return false; |
127 } | 146 } |
128 | 147 |
129 FX_BOOL CPDFSDK_BAAnnotHandler::OnRButtonDown( | 148 bool CPDFSDK_BAAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot, |
130 CPDFSDK_PageView* pPageView, | 149 uint32_t nChar, |
131 CPDFSDK_Annot::ObservedPtr* pAnnot, | 150 uint32_t nFlags) { |
132 uint32_t nFlags, | 151 return false; |
133 const CFX_FloatPoint& point) { | |
134 return FALSE; | |
135 } | 152 } |
136 | 153 |
137 FX_BOOL CPDFSDK_BAAnnotHandler::OnRButtonUp(CPDFSDK_PageView* pPageView, | 154 bool CPDFSDK_BAAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot, |
138 CPDFSDK_Annot::ObservedPtr* pAnnot, | 155 int nKeyCode, |
139 uint32_t nFlags, | 156 int nFlag) { |
140 const CFX_FloatPoint& point) { | 157 return false; |
141 return FALSE; | |
142 } | 158 } |
143 | 159 |
144 FX_BOOL CPDFSDK_BAAnnotHandler::OnRButtonDblClk( | 160 bool CPDFSDK_BAAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot, |
145 CPDFSDK_PageView* pPageView, | 161 int nKeyCode, |
146 CPDFSDK_Annot::ObservedPtr* pAnnot, | 162 int nFlag) { |
147 uint32_t nFlags, | 163 return false; |
148 const CFX_FloatPoint& point) { | |
149 return FALSE; | |
150 } | |
151 | |
152 FX_BOOL CPDFSDK_BAAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot, | |
153 uint32_t nChar, | |
154 uint32_t nFlags) { | |
155 return FALSE; | |
156 } | |
157 | |
158 FX_BOOL CPDFSDK_BAAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot, | |
159 int nKeyCode, | |
160 int nFlag) { | |
161 return FALSE; | |
162 } | |
163 | |
164 FX_BOOL CPDFSDK_BAAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot, | |
165 int nKeyCode, | |
166 int nFlag) { | |
167 return FALSE; | |
168 } | 164 } |
169 | 165 |
170 void CPDFSDK_BAAnnotHandler::OnLoad(CPDFSDK_Annot* pAnnot) {} | 166 void CPDFSDK_BAAnnotHandler::OnLoad(CPDFSDK_Annot* pAnnot) {} |
171 | 167 |
172 FX_BOOL CPDFSDK_BAAnnotHandler::OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, | 168 bool CPDFSDK_BAAnnotHandler::OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, |
173 uint32_t nFlag) { | 169 uint32_t nFlag) { |
174 return FALSE; | 170 return false; |
175 } | 171 } |
176 | 172 |
177 FX_BOOL CPDFSDK_BAAnnotHandler::OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, | 173 bool CPDFSDK_BAAnnotHandler::OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, |
178 uint32_t nFlag) { | 174 uint32_t nFlag) { |
179 return FALSE; | 175 return false; |
180 } | 176 } |
181 | 177 |
182 #ifdef PDF_ENABLE_XFA | 178 #ifdef PDF_ENABLE_XFA |
183 FX_BOOL CPDFSDK_BAAnnotHandler::OnXFAChangedFocus( | 179 bool CPDFSDK_BAAnnotHandler::OnXFAChangedFocus( |
184 CPDFSDK_Annot::ObservedPtr* pOldAnnot, | 180 CPDFSDK_Annot::ObservedPtr* pOldAnnot, |
185 CPDFSDK_Annot::ObservedPtr* pNewAnnot) { | 181 CPDFSDK_Annot::ObservedPtr* pNewAnnot) { |
186 return TRUE; | 182 return true; |
187 } | 183 } |
188 #endif // PDF_ENABLE_XFA | 184 #endif // PDF_ENABLE_XFA |
189 | 185 |
190 CFX_FloatRect CPDFSDK_BAAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView, | 186 CFX_FloatRect CPDFSDK_BAAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView, |
191 CPDFSDK_Annot* pAnnot) { | 187 CPDFSDK_Annot* pAnnot) { |
192 return pAnnot->GetRect(); | 188 return pAnnot->GetRect(); |
193 } | 189 } |
194 | 190 |
195 FX_BOOL CPDFSDK_BAAnnotHandler::HitTest(CPDFSDK_PageView* pPageView, | 191 bool CPDFSDK_BAAnnotHandler::HitTest(CPDFSDK_PageView* pPageView, |
196 CPDFSDK_Annot* pAnnot, | 192 CPDFSDK_Annot* pAnnot, |
197 const CFX_FloatPoint& point) { | 193 const CFX_FloatPoint& point) { |
198 ASSERT(pPageView); | 194 ASSERT(pPageView); |
199 ASSERT(pAnnot); | 195 ASSERT(pAnnot); |
200 | 196 |
201 CFX_FloatRect rect = GetViewBBox(pPageView, pAnnot); | 197 CFX_FloatRect rect = GetViewBBox(pPageView, pAnnot); |
202 return rect.Contains(point.x, point.y); | 198 return rect.Contains(point.x, point.y); |
203 } | 199 } |
OLD | NEW |