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/include/cpdfsdk_baannothandler.h" | 7 #include "fpdfsdk/include/cpdfsdk_baannothandler.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <vector> | 10 #include <vector> |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 static_cast<CPDFSDK_BAAnnot*>(pAnnot)->DrawAppearance( | 72 static_cast<CPDFSDK_BAAnnot*>(pAnnot)->DrawAppearance( |
73 pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); | 73 pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 void CPDFSDK_BAAnnotHandler::OnDelete(CPDFSDK_Annot* pAnnot) {} | 77 void CPDFSDK_BAAnnotHandler::OnDelete(CPDFSDK_Annot* pAnnot) {} |
78 | 78 |
79 void CPDFSDK_BAAnnotHandler::OnRelease(CPDFSDK_Annot* pAnnot) {} | 79 void CPDFSDK_BAAnnotHandler::OnRelease(CPDFSDK_Annot* pAnnot) {} |
80 | 80 |
81 void CPDFSDK_BAAnnotHandler::OnMouseEnter(CPDFSDK_PageView* pPageView, | 81 void CPDFSDK_BAAnnotHandler::OnMouseEnter(CPDFSDK_PageView* pPageView, |
82 CPDFSDK_Annot* pAnnot, | 82 CPDFSDK_Annot::ObservedPtr* pAnnot, |
83 uint32_t nFlag) { | 83 uint32_t nFlag) { |
84 CPDFSDK_BAAnnot* pBAAnnot = static_cast<CPDFSDK_BAAnnot*>(pAnnot); | 84 CPDFSDK_BAAnnot* pBAAnnot = static_cast<CPDFSDK_BAAnnot*>(pAnnot->Get()); |
85 pBAAnnot->SetOpenState(true); | 85 pBAAnnot->SetOpenState(true); |
86 UpdateAnnotRects(pPageView, pBAAnnot); | 86 UpdateAnnotRects(pPageView, pBAAnnot); |
87 } | 87 } |
88 | 88 |
89 void CPDFSDK_BAAnnotHandler::OnMouseExit(CPDFSDK_PageView* pPageView, | 89 void CPDFSDK_BAAnnotHandler::OnMouseExit(CPDFSDK_PageView* pPageView, |
90 CPDFSDK_Annot* pAnnot, | 90 CPDFSDK_Annot::ObservedPtr* pAnnot, |
91 uint32_t nFlag) { | 91 uint32_t nFlag) { |
92 CPDFSDK_BAAnnot* pBAAnnot = static_cast<CPDFSDK_BAAnnot*>(pAnnot); | 92 CPDFSDK_BAAnnot* pBAAnnot = static_cast<CPDFSDK_BAAnnot*>(pAnnot->Get()); |
93 pBAAnnot->SetOpenState(false); | 93 pBAAnnot->SetOpenState(false); |
94 UpdateAnnotRects(pPageView, pBAAnnot); | 94 UpdateAnnotRects(pPageView, pBAAnnot); |
95 } | 95 } |
96 | 96 |
97 FX_BOOL CPDFSDK_BAAnnotHandler::OnLButtonDown(CPDFSDK_PageView* pPageView, | 97 FX_BOOL CPDFSDK_BAAnnotHandler::OnLButtonDown( |
98 CPDFSDK_Annot* pAnnot, | 98 CPDFSDK_PageView* pPageView, |
99 uint32_t nFlags, | 99 CPDFSDK_Annot::ObservedPtr* pAnnot, |
100 const CFX_FloatPoint& point) { | 100 uint32_t nFlags, |
| 101 const CFX_FloatPoint& point) { |
101 return FALSE; | 102 return FALSE; |
102 } | 103 } |
103 | 104 |
104 FX_BOOL CPDFSDK_BAAnnotHandler::OnLButtonUp(CPDFSDK_PageView* pPageView, | 105 FX_BOOL CPDFSDK_BAAnnotHandler::OnLButtonUp(CPDFSDK_PageView* pPageView, |
105 CPDFSDK_Annot* pAnnot, | 106 CPDFSDK_Annot::ObservedPtr* pAnnot, |
106 uint32_t nFlags, | 107 uint32_t nFlags, |
107 const CFX_FloatPoint& point) { | 108 const CFX_FloatPoint& point) { |
108 return FALSE; | 109 return FALSE; |
109 } | 110 } |
110 | 111 |
111 FX_BOOL CPDFSDK_BAAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView, | 112 FX_BOOL CPDFSDK_BAAnnotHandler::OnLButtonDblClk( |
112 CPDFSDK_Annot* pAnnot, | 113 CPDFSDK_PageView* pPageView, |
113 uint32_t nFlags, | 114 CPDFSDK_Annot::ObservedPtr* pAnnot, |
114 const CFX_FloatPoint& point) { | 115 uint32_t nFlags, |
| 116 const CFX_FloatPoint& point) { |
115 return FALSE; | 117 return FALSE; |
116 } | 118 } |
117 | 119 |
118 FX_BOOL CPDFSDK_BAAnnotHandler::OnMouseMove(CPDFSDK_PageView* pPageView, | 120 FX_BOOL CPDFSDK_BAAnnotHandler::OnMouseMove(CPDFSDK_PageView* pPageView, |
119 CPDFSDK_Annot* pAnnot, | 121 CPDFSDK_Annot::ObservedPtr* pAnnot, |
120 uint32_t nFlags, | 122 uint32_t nFlags, |
121 const CFX_FloatPoint& point) { | 123 const CFX_FloatPoint& point) { |
122 return FALSE; | 124 return FALSE; |
123 } | 125 } |
124 | 126 |
125 FX_BOOL CPDFSDK_BAAnnotHandler::OnMouseWheel(CPDFSDK_PageView* pPageView, | 127 FX_BOOL CPDFSDK_BAAnnotHandler::OnMouseWheel(CPDFSDK_PageView* pPageView, |
126 CPDFSDK_Annot* pAnnot, | 128 CPDFSDK_Annot::ObservedPtr* pAnnot, |
127 uint32_t nFlags, | 129 uint32_t nFlags, |
128 short zDelta, | 130 short zDelta, |
129 const CFX_FloatPoint& point) { | 131 const CFX_FloatPoint& point) { |
130 return FALSE; | 132 return FALSE; |
131 } | 133 } |
132 | 134 |
133 FX_BOOL CPDFSDK_BAAnnotHandler::OnRButtonDown(CPDFSDK_PageView* pPageView, | 135 FX_BOOL CPDFSDK_BAAnnotHandler::OnRButtonDown( |
134 CPDFSDK_Annot* pAnnot, | 136 CPDFSDK_PageView* pPageView, |
135 uint32_t nFlags, | 137 CPDFSDK_Annot::ObservedPtr* pAnnot, |
136 const CFX_FloatPoint& point) { | 138 uint32_t nFlags, |
| 139 const CFX_FloatPoint& point) { |
137 return FALSE; | 140 return FALSE; |
138 } | 141 } |
139 | 142 |
140 FX_BOOL CPDFSDK_BAAnnotHandler::OnRButtonUp(CPDFSDK_PageView* pPageView, | 143 FX_BOOL CPDFSDK_BAAnnotHandler::OnRButtonUp(CPDFSDK_PageView* pPageView, |
141 CPDFSDK_Annot* pAnnot, | 144 CPDFSDK_Annot::ObservedPtr* pAnnot, |
142 uint32_t nFlags, | 145 uint32_t nFlags, |
143 const CFX_FloatPoint& point) { | 146 const CFX_FloatPoint& point) { |
144 return FALSE; | 147 return FALSE; |
145 } | 148 } |
146 | 149 |
147 FX_BOOL CPDFSDK_BAAnnotHandler::OnRButtonDblClk(CPDFSDK_PageView* pPageView, | 150 FX_BOOL CPDFSDK_BAAnnotHandler::OnRButtonDblClk( |
148 CPDFSDK_Annot* pAnnot, | 151 CPDFSDK_PageView* pPageView, |
149 uint32_t nFlags, | 152 CPDFSDK_Annot::ObservedPtr* pAnnot, |
150 const CFX_FloatPoint& point) { | 153 uint32_t nFlags, |
| 154 const CFX_FloatPoint& point) { |
151 return FALSE; | 155 return FALSE; |
152 } | 156 } |
153 | 157 |
154 FX_BOOL CPDFSDK_BAAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot, | 158 FX_BOOL CPDFSDK_BAAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot, |
155 uint32_t nChar, | 159 uint32_t nChar, |
156 uint32_t nFlags) { | 160 uint32_t nFlags) { |
157 return FALSE; | 161 return FALSE; |
158 } | 162 } |
159 | 163 |
160 FX_BOOL CPDFSDK_BAAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot, | 164 FX_BOOL CPDFSDK_BAAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot, |
161 int nKeyCode, | 165 int nKeyCode, |
162 int nFlag) { | 166 int nFlag) { |
163 return FALSE; | 167 return FALSE; |
164 } | 168 } |
165 | 169 |
166 FX_BOOL CPDFSDK_BAAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot, | 170 FX_BOOL CPDFSDK_BAAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot, |
167 int nKeyCode, | 171 int nKeyCode, |
168 int nFlag) { | 172 int nFlag) { |
169 return FALSE; | 173 return FALSE; |
170 } | 174 } |
171 | 175 |
172 void CPDFSDK_BAAnnotHandler::OnDeSelected(CPDFSDK_Annot* pAnnot) {} | 176 void CPDFSDK_BAAnnotHandler::OnDeSelected(CPDFSDK_Annot* pAnnot) {} |
173 | 177 |
174 void CPDFSDK_BAAnnotHandler::OnSelected(CPDFSDK_Annot* pAnnot) {} | 178 void CPDFSDK_BAAnnotHandler::OnSelected(CPDFSDK_Annot* pAnnot) {} |
175 | 179 |
176 void CPDFSDK_BAAnnotHandler::OnCreate(CPDFSDK_Annot* pAnnot) {} | 180 void CPDFSDK_BAAnnotHandler::OnCreate(CPDFSDK_Annot* pAnnot) {} |
177 | 181 |
178 void CPDFSDK_BAAnnotHandler::OnLoad(CPDFSDK_Annot* pAnnot) {} | 182 void CPDFSDK_BAAnnotHandler::OnLoad(CPDFSDK_Annot* pAnnot) {} |
179 | 183 |
180 FX_BOOL CPDFSDK_BAAnnotHandler::OnSetFocus(CPDFSDK_Annot* pAnnot, | 184 FX_BOOL CPDFSDK_BAAnnotHandler::OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, |
181 uint32_t nFlag) { | 185 uint32_t nFlag) { |
182 return FALSE; | 186 return FALSE; |
183 } | 187 } |
184 | 188 |
185 FX_BOOL CPDFSDK_BAAnnotHandler::OnKillFocus(CPDFSDK_Annot* pAnnot, | 189 FX_BOOL CPDFSDK_BAAnnotHandler::OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, |
186 uint32_t nFlag) { | 190 uint32_t nFlag) { |
187 return FALSE; | 191 return FALSE; |
188 } | 192 } |
189 | 193 |
190 #ifdef PDF_ENABLE_XFA | 194 #ifdef PDF_ENABLE_XFA |
191 FX_BOOL CPDFSDK_BAAnnotHandler::OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, | 195 FX_BOOL CPDFSDK_BAAnnotHandler::OnXFAChangedFocus( |
192 CPDFSDK_Annot* pNewAnnot) { | 196 CPDFSDK_Annot::ObservedPtr* pOldAnnot, |
| 197 CPDFSDK_Annot::ObservedPtr* pNewAnnot) { |
193 return TRUE; | 198 return TRUE; |
194 } | 199 } |
195 #endif // PDF_ENABLE_XFA | 200 #endif // PDF_ENABLE_XFA |
196 | 201 |
197 CFX_FloatRect CPDFSDK_BAAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView, | 202 CFX_FloatRect CPDFSDK_BAAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView, |
198 CPDFSDK_Annot* pAnnot) { | 203 CPDFSDK_Annot* pAnnot) { |
199 return pAnnot->GetRect(); | 204 return pAnnot->GetRect(); |
200 } | 205 } |
201 | 206 |
202 FX_BOOL CPDFSDK_BAAnnotHandler::HitTest(CPDFSDK_PageView* pPageView, | 207 FX_BOOL CPDFSDK_BAAnnotHandler::HitTest(CPDFSDK_PageView* pPageView, |
203 CPDFSDK_Annot* pAnnot, | 208 CPDFSDK_Annot* pAnnot, |
204 const CFX_FloatPoint& point) { | 209 const CFX_FloatPoint& point) { |
205 ASSERT(pPageView); | 210 ASSERT(pPageView); |
206 ASSERT(pAnnot); | 211 ASSERT(pAnnot); |
207 | 212 |
208 CFX_FloatRect rect = GetViewBBox(pPageView, pAnnot); | 213 CFX_FloatRect rect = GetViewBBox(pPageView, pAnnot); |
209 return rect.Contains(point.x, point.y); | 214 return rect.Contains(point.x, point.y); |
210 } | 215 } |
OLD | NEW |