| 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/fsdk_define.h" | 7 #include "../include/fsdk_define.h" |
| 8 #include "../include/fsdk_mgr.h" | 8 #include "../include/fsdk_mgr.h" |
| 9 #include "../include/formfiller/FFL_FormFiller.h" | 9 #include "../include/formfiller/FFL_FormFiller.h" |
| 10 #include "../include/fsdk_annothandler.h" | 10 #include "../include/fsdk_annothandler.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 { | 137 { |
| 138 pAnnotHandler->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags)
; | 138 pAnnotHandler->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags)
; |
| 139 } | 139 } |
| 140 else | 140 else |
| 141 { | 141 { |
| 142 pAnnot->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); | 142 pAnnot->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); |
| 143 } | 143 } |
| 144 } | 144 } |
| 145 | 145 |
| 146 | 146 |
| 147 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDown(CPDFSDK_PageView * pPageVie
w, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 147 bool CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDown(CPDFSDK_PageView * pPageView,
CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
| 148 { | 148 { |
| 149 ASSERT(pAnnot != NULL); | 149 ASSERT(pAnnot != NULL); |
| 150 | 150 |
| 151 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 151 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
| 152 { | 152 { |
| 153 return pAnnotHandler->OnLButtonDown(pPageView, pAnnot, nFlags, point); | 153 return pAnnotHandler->OnLButtonDown(pPageView, pAnnot, nFlags, point); |
| 154 } | 154 } |
| 155 return FALSE; | 155 return false; |
| 156 } | 156 } |
| 157 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonUp(CPDFSDK_PageView * pPageView,
CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 157 bool CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonUp(CPDFSDK_PageView * pPageView, CP
DFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
| 158 { | 158 { |
| 159 ASSERT(pAnnot != NULL); | 159 ASSERT(pAnnot != NULL); |
| 160 | 160 |
| 161 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 161 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
| 162 { | 162 { |
| 163 return pAnnotHandler->OnLButtonUp(pPageView, pAnnot, nFlags, point); | 163 return pAnnotHandler->OnLButtonUp(pPageView, pAnnot, nFlags, point); |
| 164 } | 164 } |
| 165 return FALSE; | 165 return false; |
| 166 } | 166 } |
| 167 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDblClk(CPDFSDK_PageView * pPageV
iew, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 167 bool CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDblClk(CPDFSDK_PageView * pPageView
, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
| 168 { | 168 { |
| 169 ASSERT(pAnnot != NULL); | 169 ASSERT(pAnnot != NULL); |
| 170 | 170 |
| 171 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 171 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
| 172 { | 172 { |
| 173 return pAnnotHandler->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); | 173 return pAnnotHandler->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); |
| 174 } | 174 } |
| 175 return FALSE; | 175 return false; |
| 176 } | 176 } |
| 177 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseMove(CPDFSDK_PageView * pPageView,
CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 177 bool CPDFSDK_AnnotHandlerMgr::Annot_OnMouseMove(CPDFSDK_PageView * pPageView, CP
DFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
| 178 { | 178 { |
| 179 ASSERT(pAnnot != NULL); | 179 ASSERT(pAnnot != NULL); |
| 180 | 180 |
| 181 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 181 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
| 182 { | 182 { |
| 183 return pAnnotHandler->OnMouseMove(pPageView, pAnnot, nFlags, point); | 183 return pAnnotHandler->OnMouseMove(pPageView, pAnnot, nFlags, point); |
| 184 } | 184 } |
| 185 return FALSE; | 185 return false; |
| 186 } | 186 } |
| 187 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseWheel(CPDFSDK_PageView * pPageView
, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, short zDelta, const CPDF_Point& point) | 187 bool CPDFSDK_AnnotHandlerMgr::Annot_OnMouseWheel(CPDFSDK_PageView * pPageView, C
PDFSDK_Annot* pAnnot, FX_DWORD nFlags, short zDelta, const CPDF_Point& point) |
| 188 { | 188 { |
| 189 ASSERT(pAnnot != NULL); | 189 ASSERT(pAnnot != NULL); |
| 190 | 190 |
| 191 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 191 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
| 192 { | 192 { |
| 193 return pAnnotHandler->OnMouseWheel(pPageView, pAnnot,nFlags,zDelta, poin
t); | 193 return pAnnotHandler->OnMouseWheel(pPageView, pAnnot,nFlags,zDelta, poin
t); |
| 194 } | 194 } |
| 195 return FALSE; | 195 return false; |
| 196 } | 196 } |
| 197 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonDown(CPDFSDK_PageView * pPageVie
w, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 197 bool CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonDown(CPDFSDK_PageView * pPageView,
CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
| 198 { | 198 { |
| 199 ASSERT(pAnnot != NULL); | 199 ASSERT(pAnnot != NULL); |
| 200 | 200 |
| 201 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 201 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
| 202 { | 202 { |
| 203 return pAnnotHandler->OnRButtonDown(pPageView, pAnnot, nFlags, point); | 203 return pAnnotHandler->OnRButtonDown(pPageView, pAnnot, nFlags, point); |
| 204 } | 204 } |
| 205 return FALSE; | 205 return false; |
| 206 } | 206 } |
| 207 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonUp(CPDFSDK_PageView * pPageView,
CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 207 bool CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonUp(CPDFSDK_PageView * pPageView, CP
DFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
| 208 { | 208 { |
| 209 ASSERT(pAnnot != NULL); | 209 ASSERT(pAnnot != NULL); |
| 210 | 210 |
| 211 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 211 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
| 212 { | 212 { |
| 213 return pAnnotHandler->OnRButtonUp(pPageView, pAnnot, nFlags, point); | 213 return pAnnotHandler->OnRButtonUp(pPageView, pAnnot, nFlags, point); |
| 214 } | 214 } |
| 215 return FALSE; | 215 return false; |
| 216 } | 216 } |
| 217 | 217 |
| 218 void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseEnter(CPDFSDK_PageView * pPageView, C
PDFSDK_Annot* pAnnot, FX_DWORD nFlag) | 218 void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseEnter(CPDFSDK_PageView * pPageView, C
PDFSDK_Annot* pAnnot, FX_DWORD nFlag) |
| 219 { | 219 { |
| 220 ASSERT(pAnnot != NULL); | 220 ASSERT(pAnnot != NULL); |
| 221 | 221 |
| 222 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 222 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
| 223 { | 223 { |
| 224 pAnnotHandler->OnMouseEnter(pPageView, pAnnot, nFlag); | 224 pAnnotHandler->OnMouseEnter(pPageView, pAnnot, nFlag); |
| 225 } | 225 } |
| 226 return ; | 226 return ; |
| 227 } | 227 } |
| 228 | 228 |
| 229 void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseExit(CPDFSDK_PageView * pPageView, CP
DFSDK_Annot* pAnnot, FX_DWORD nFlag) | 229 void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseExit(CPDFSDK_PageView * pPageView, CP
DFSDK_Annot* pAnnot, FX_DWORD nFlag) |
| 230 { | 230 { |
| 231 ASSERT(pAnnot != NULL); | 231 ASSERT(pAnnot != NULL); |
| 232 | 232 |
| 233 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 233 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
| 234 { | 234 { |
| 235 pAnnotHandler->OnMouseExit(pPageView, pAnnot, nFlag); | 235 pAnnotHandler->OnMouseExit(pPageView, pAnnot, nFlag); |
| 236 } | 236 } |
| 237 return; | 237 return; |
| 238 } | 238 } |
| 239 | 239 |
| 240 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nC
har, FX_DWORD nFlags) | 240 bool CPDFSDK_AnnotHandlerMgr::Annot_OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nChar
, FX_DWORD nFlags) |
| 241 { | 241 { |
| 242 | 242 |
| 243 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 243 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
| 244 { | 244 { |
| 245 return pAnnotHandler->OnChar(pAnnot,nChar, nFlags); | 245 return pAnnotHandler->OnChar(pAnnot,nChar, nFlags); |
| 246 } | 246 } |
| 247 return FALSE; | 247 return false; |
| 248 | 248 |
| 249 } | 249 } |
| 250 | 250 |
| 251 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKeyDown(CPDFSDK_Annot* pAnnot,
int nKeyCode, int nFlag) | 251 bool CPDFSDK_AnnotHandlerMgr::Annot_OnKeyDown(CPDFSDK_Annot* pAnnot, int
nKeyCode, int nFlag) |
| 252 { | 252 { |
| 253 | 253 |
| 254 if (!m_pApp->FFI_IsCTRLKeyDown(nFlag) && !m_pApp->FFI_IsALTKeyDown(nFlag)) | 254 if (!m_pApp->FFI_IsCTRLKeyDown(nFlag) && !m_pApp->FFI_IsALTKeyDown(nFlag)) |
| 255 { | 255 { |
| 256 CPDFSDK_PageView* pPage = pAnnot->GetPageView(); | 256 CPDFSDK_PageView* pPage = pAnnot->GetPageView(); |
| 257 CPDFSDK_Annot* pFocusAnnot = pPage->GetFocusAnnot(); | 257 CPDFSDK_Annot* pFocusAnnot = pPage->GetFocusAnnot(); |
| 258 if (pFocusAnnot && (nKeyCode == FWL_VKEY_Tab)) | 258 if (pFocusAnnot && (nKeyCode == FWL_VKEY_Tab)) |
| 259 { | 259 { |
| 260 CPDFSDK_Annot* pNext = GetNextAnnot(pFocusAnnot, !m_pApp->FFI_IsSHIF
TKeyDown(nFlag)); | 260 CPDFSDK_Annot* pNext = GetNextAnnot(pFocusAnnot, !m_pApp->FFI_IsSHIF
TKeyDown(nFlag)); |
| 261 | 261 |
| 262 if(pNext && pNext != pFocusAnnot) | 262 if(pNext && pNext != pFocusAnnot) |
| 263 { | 263 { |
| 264 CPDFSDK_Document* pDocument = pPage->GetSDKDocument(); | 264 CPDFSDK_Document* pDocument = pPage->GetSDKDocument(); |
| 265 pDocument->SetFocusAnnot(pNext); | 265 pDocument->SetFocusAnnot(pNext); |
| 266 return TRUE; | 266 return true; |
| 267 } | 267 } |
| 268 } | 268 } |
| 269 } | 269 } |
| 270 | 270 |
| 271 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 271 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
| 272 { | 272 { |
| 273 return pAnnotHandler->OnKeyDown(pAnnot,nKeyCode, nFlag); | 273 return pAnnotHandler->OnKeyDown(pAnnot,nKeyCode, nFlag); |
| 274 } | 274 } |
| 275 return FALSE; | 275 return false; |
| 276 } | 276 } |
| 277 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKeyUp(CPDFSDK_Annot* pAnnot, in
t nKeyCode, int nFlag) | 277 bool CPDFSDK_AnnotHandlerMgr::Annot_OnKeyUp(CPDFSDK_Annot* pAnnot, int n
KeyCode, int nFlag) |
| 278 { | 278 { |
| 279 return FALSE; | 279 return false; |
| 280 } | 280 } |
| 281 | 281 |
| 282 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnSetFocus(CPDFSDK_Annot* pAnnot,
FX_DWORD nFlag) | 282 bool CPDFSDK_AnnotHandlerMgr::Annot_OnSetFocus(CPDFSDK_Annot* pAnnot, FX
_DWORD nFlag) |
| 283 { | 283 { |
| 284 ASSERT(pAnnot != NULL); | 284 ASSERT(pAnnot != NULL); |
| 285 | 285 |
| 286 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 286 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
| 287 { | 287 { |
| 288 if (pAnnotHandler->OnSetFocus(pAnnot, nFlag)) | 288 if (pAnnotHandler->OnSetFocus(pAnnot, nFlag)) |
| 289 { | 289 { |
| 290 CPDFSDK_PageView* pPage = pAnnot->GetPageView(); | 290 CPDFSDK_PageView* pPage = pAnnot->GetPageView(); |
| 291 ASSERT(pPage != NULL); | 291 ASSERT(pPage != NULL); |
| 292 | 292 |
| 293 pPage->GetSDKDocument(); | 293 pPage->GetSDKDocument(); |
| 294 // pDocument->SetTopmostAnnot(pAnnot); | 294 // pDocument->SetTopmostAnnot(pAnnot); |
| 295 | 295 |
| 296 return TRUE; | 296 return true; |
| 297 } | 297 } |
| 298 else | 298 else |
| 299 { | 299 { |
| 300 return FALSE; | 300 return false; |
| 301 } | 301 } |
| 302 } | 302 } |
| 303 | 303 |
| 304 return FALSE; | 304 return false; |
| 305 } | 305 } |
| 306 | 306 |
| 307 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKillFocus(CPDFSDK_Annot* pAnnot
, FX_DWORD nFlag) | 307 bool CPDFSDK_AnnotHandlerMgr::Annot_OnKillFocus(CPDFSDK_Annot* pAnnot, F
X_DWORD nFlag) |
| 308 { | 308 { |
| 309 ASSERT(pAnnot != NULL); | 309 ASSERT(pAnnot != NULL); |
| 310 | 310 |
| 311 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 311 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
| 312 { | 312 { |
| 313 if (pAnnotHandler->OnKillFocus(pAnnot, nFlag)) | 313 if (pAnnotHandler->OnKillFocus(pAnnot, nFlag)) |
| 314 { | 314 { |
| 315 return TRUE; | 315 return true; |
| 316 } | 316 } |
| 317 else | 317 else |
| 318 return FALSE; | 318 return false; |
| 319 } | 319 } |
| 320 | 320 |
| 321 return FALSE; | 321 return false; |
| 322 } | 322 } |
| 323 | 323 |
| 324 CPDF_Rect CPDFSDK_AnnotHandlerMgr::Annot_OnGetViewBBox(CPDFSDK_PageView *pPage
View, CPDFSDK_Annot* pAnnot) | 324 CPDF_Rect CPDFSDK_AnnotHandlerMgr::Annot_OnGetViewBBox(CPDFSDK_PageView *pPage
View, CPDFSDK_Annot* pAnnot) |
| 325 { | 325 { |
| 326 ASSERT(pAnnot); | 326 ASSERT(pAnnot); |
| 327 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 327 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
| 328 { | 328 { |
| 329 return pAnnotHandler->GetViewBBox(pPageView, pAnnot); | 329 return pAnnotHandler->GetViewBBox(pPageView, pAnnot); |
| 330 } | 330 } |
| 331 return pAnnot->GetRect(); | 331 return pAnnot->GetRect(); |
| 332 } | 332 } |
| 333 | 333 |
| 334 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnHitTest(CPDFSDK_PageView *pPageView, CP
DFSDK_Annot* pAnnot, const CPDF_Point& point) | 334 bool CPDFSDK_AnnotHandlerMgr::Annot_OnHitTest(CPDFSDK_PageView *pPageView, CPDFS
DK_Annot* pAnnot, const CPDF_Point& point) |
| 335 { | 335 { |
| 336 ASSERT(pAnnot); | 336 ASSERT(pAnnot); |
| 337 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 337 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
| 338 { | 338 { |
| 339 if(pAnnotHandler->CanAnswer(pAnnot)) | 339 if(pAnnotHandler->CanAnswer(pAnnot)) |
| 340 return pAnnotHandler->HitTest(pPageView, pAnnot, point); | 340 return pAnnotHandler->HitTest(pPageView, pAnnot, point); |
| 341 } | 341 } |
| 342 return FALSE; | 342 return false; |
| 343 } | 343 } |
| 344 | 344 |
| 345 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::GetNextAnnot(CPDFSDK_Annot* pSDKAnnot,F
X_BOOL bNext) | 345 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::GetNextAnnot(CPDFSDK_Annot* pSDKAnnot,b
ool bNext) |
| 346 { | 346 { |
| 347 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), "Widget", ""); | 347 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), "Widget", ""); |
| 348 return bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot); | 348 return bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot); |
| 349 } | 349 } |
| 350 | 350 |
| 351 FX_BOOL CPDFSDK_BFAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) | 351 bool CPDFSDK_BFAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) |
| 352 { | 352 { |
| 353 ASSERT(pAnnot); | 353 ASSERT(pAnnot); |
| 354 ASSERT(pAnnot->GetType() == "Widget"); | 354 ASSERT(pAnnot->GetType() == "Widget"); |
| 355 CFX_ByteString sSubType = pAnnot->GetSubType(); | 355 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 356 | 356 |
| 357 if (sSubType == BFFT_SIGNATURE) | 357 if (sSubType == BFFT_SIGNATURE) |
| 358 { | 358 { |
| 359 } | 359 } |
| 360 else | 360 else |
| 361 { | 361 { |
| 362 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 362 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 363 if (!pWidget->IsVisible()) return FALSE; | 363 if (!pWidget->IsVisible()) return false; |
| 364 | 364 |
| 365 int nFieldFlags = pWidget->GetFieldFlags(); | 365 int nFieldFlags = pWidget->GetFieldFlags(); |
| 366 if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) return FAL
SE; | 366 if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) return fal
se; |
| 367 if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON) | 367 if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON) |
| 368 return TRUE; | 368 return true; |
| 369 else | 369 else |
| 370 { | 370 { |
| 371 CPDF_Page* pPage = pWidget->GetPDFPage(); | 371 CPDF_Page* pPage = pWidget->GetPDFPage(); |
| 372 ASSERT(pPage != NULL); | 372 ASSERT(pPage != NULL); |
| 373 | 373 |
| 374 CPDF_Document* pDocument = pPage->m_pDocument; | 374 CPDF_Document* pDocument = pPage->m_pDocument; |
| 375 ASSERT(pDocument != NULL); | 375 ASSERT(pDocument != NULL); |
| 376 | 376 |
| 377 FX_DWORD dwPermissions = pDocument->GetUserPermissions(); | 377 FX_DWORD dwPermissions = pDocument->GetUserPermissions(); |
| 378 return (dwPermissions&FPDFPERM_FILL_FORM) || | 378 return (dwPermissions&FPDFPERM_FILL_FORM) || |
| 379 (dwPermissions&FPDFPERM_ANNOT_FORM) || | 379 (dwPermissions&FPDFPERM_ANNOT_FORM) || |
| 380 (dwPermissions&FPDFPERM_ANNOT_FORM); | 380 (dwPermissions&FPDFPERM_ANNOT_FORM); |
| 381 } | 381 } |
| 382 } | 382 } |
| 383 | 383 |
| 384 return FALSE; | 384 return false; |
| 385 } | 385 } |
| 386 | 386 |
| 387 CPDFSDK_Annot* CPDFSDK_BFAnnotHandler::NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_Page
View* pPage) | 387 CPDFSDK_Annot* CPDFSDK_BFAnnotHandler::NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_Page
View* pPage) |
| 388 { | 388 { |
| 389 CPDFSDK_Document* pSDKDoc = m_pApp->GetSDKDocument(); | 389 CPDFSDK_Document* pSDKDoc = m_pApp->GetSDKDocument(); |
| 390 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pSDKDoc->GetInterForm(); | 390 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pSDKDoc->GetInterForm(); |
| 391 CPDF_FormControl* pCtrl = CPDFSDK_Widget::GetFormControl(pInterForm->GetInte
rForm(), pAnnot->GetAnnotDict()); | 391 CPDF_FormControl* pCtrl = CPDFSDK_Widget::GetFormControl(pInterForm->GetInte
rForm(), pAnnot->GetAnnotDict()); |
| 392 if (!pCtrl) | 392 if (!pCtrl) |
| 393 return nullptr; | 393 return nullptr; |
| 394 | 394 |
| 395 CPDFSDK_Widget* pWidget = new CPDFSDK_Widget(pAnnot, pPage, pInterForm); | 395 CPDFSDK_Widget* pWidget = new CPDFSDK_Widget(pAnnot, pPage, pInterForm); |
| 396 pInterForm->AddMap(pCtrl, pWidget); | 396 pInterForm->AddMap(pCtrl, pWidget); |
| 397 CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); | 397 CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); |
| 398 if (pPDFInterForm && pPDFInterForm->NeedConstructAP()) | 398 if (pPDFInterForm && pPDFInterForm->NeedConstructAP()) |
| 399 pWidget->ResetAppearance(nullptr, FALSE); | 399 pWidget->ResetAppearance(nullptr, false); |
| 400 | 400 |
| 401 return pWidget; | 401 return pWidget; |
| 402 } | 402 } |
| 403 | 403 |
| 404 void CPDFSDK_BFAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) | 404 void CPDFSDK_BFAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) |
| 405 { | 405 { |
| 406 ASSERT(pAnnot != NULL); | 406 ASSERT(pAnnot != NULL); |
| 407 | 407 |
| 408 if (m_pFormFiller) | 408 if (m_pFormFiller) |
| 409 m_pFormFiller->OnDelete(pAnnot); | 409 m_pFormFiller->OnDelete(pAnnot); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 if (sSubType == BFFT_SIGNATURE) | 462 if (sSubType == BFFT_SIGNATURE) |
| 463 { | 463 { |
| 464 } | 464 } |
| 465 else | 465 else |
| 466 { | 466 { |
| 467 if (m_pFormFiller) | 467 if (m_pFormFiller) |
| 468 m_pFormFiller->OnMouseExit(pPageView, pAnnot, nFlag); | 468 m_pFormFiller->OnMouseExit(pPageView, pAnnot, nFlag); |
| 469 } | 469 } |
| 470 | 470 |
| 471 } | 471 } |
| 472 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFS
DK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 472 bool CPDFSDK_BFAnnotHandler::OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_
Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
| 473 { | 473 { |
| 474 ASSERT(pAnnot != NULL); | 474 ASSERT(pAnnot != NULL); |
| 475 CFX_ByteString sSubType = pAnnot->GetSubType(); | 475 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 476 | 476 |
| 477 if (sSubType == BFFT_SIGNATURE) | 477 if (sSubType == BFFT_SIGNATURE) |
| 478 { | 478 { |
| 479 } | 479 } |
| 480 else | 480 else |
| 481 { | 481 { |
| 482 if (m_pFormFiller) | 482 if (m_pFormFiller) |
| 483 return m_pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point
); | 483 return m_pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point
); |
| 484 } | 484 } |
| 485 | 485 |
| 486 return FALSE; | 486 return false; |
| 487 } | 487 } |
| 488 | 488 |
| 489 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK
_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 489 bool CPDFSDK_BFAnnotHandler::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_An
not* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
| 490 { | 490 { |
| 491 ASSERT(pAnnot != NULL); | 491 ASSERT(pAnnot != NULL); |
| 492 CFX_ByteString sSubType = pAnnot->GetSubType(); | 492 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 493 | 493 |
| 494 if (sSubType == BFFT_SIGNATURE) | 494 if (sSubType == BFFT_SIGNATURE) |
| 495 { | 495 { |
| 496 } | 496 } |
| 497 else | 497 else |
| 498 { | 498 { |
| 499 if (m_pFormFiller) | 499 if (m_pFormFiller) |
| 500 return m_pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point); | 500 return m_pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point); |
| 501 } | 501 } |
| 502 | 502 |
| 503 return FALSE; | 503 return false; |
| 504 } | 504 } |
| 505 | 505 |
| 506 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPD
FSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 506 bool CPDFSDK_BFAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSD
K_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
| 507 { | 507 { |
| 508 ASSERT(pAnnot != NULL); | 508 ASSERT(pAnnot != NULL); |
| 509 CFX_ByteString sSubType = pAnnot->GetSubType(); | 509 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 510 | 510 |
| 511 if (sSubType == BFFT_SIGNATURE) | 511 if (sSubType == BFFT_SIGNATURE) |
| 512 { | 512 { |
| 513 } | 513 } |
| 514 else | 514 else |
| 515 { | 515 { |
| 516 if (m_pFormFiller) | 516 if (m_pFormFiller) |
| 517 return m_pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, poi
nt); | 517 return m_pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, poi
nt); |
| 518 } | 518 } |
| 519 | 519 |
| 520 return FALSE; | 520 return false; |
| 521 } | 521 } |
| 522 | 522 |
| 523 FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK
_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 523 bool CPDFSDK_BFAnnotHandler::OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_An
not* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
| 524 { | 524 { |
| 525 ASSERT(pAnnot != NULL); | 525 ASSERT(pAnnot != NULL); |
| 526 CFX_ByteString sSubType = pAnnot->GetSubType(); | 526 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 527 | 527 |
| 528 if (sSubType == BFFT_SIGNATURE) | 528 if (sSubType == BFFT_SIGNATURE) |
| 529 { | 529 { |
| 530 } | 530 } |
| 531 else | 531 else |
| 532 { | 532 { |
| 533 if (m_pFormFiller) | 533 if (m_pFormFiller) |
| 534 return m_pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point); | 534 return m_pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point); |
| 535 } | 535 } |
| 536 | 536 |
| 537 return FALSE; | 537 return false; |
| 538 | 538 |
| 539 } | 539 } |
| 540 | 540 |
| 541 | 541 |
| 542 FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSD
K_Annot* pAnnot, FX_DWORD nFlags, short zDelta, const CPDF_Point& point) | 542 bool CPDFSDK_BFAnnotHandler::OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSDK_A
nnot* pAnnot, FX_DWORD nFlags, short zDelta, const CPDF_Point& point) |
| 543 { | 543 { |
| 544 ASSERT(pAnnot != NULL); | 544 ASSERT(pAnnot != NULL); |
| 545 CFX_ByteString sSubType = pAnnot->GetSubType(); | 545 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 546 | 546 |
| 547 if (sSubType == BFFT_SIGNATURE) | 547 if (sSubType == BFFT_SIGNATURE) |
| 548 { | 548 { |
| 549 } | 549 } |
| 550 else | 550 else |
| 551 { | 551 { |
| 552 if (m_pFormFiller) | 552 if (m_pFormFiller) |
| 553 return m_pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta
,point); | 553 return m_pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta
,point); |
| 554 } | 554 } |
| 555 | 555 |
| 556 return FALSE; | 556 return false; |
| 557 } | 557 } |
| 558 | 558 |
| 559 FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFS
DK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 559 bool CPDFSDK_BFAnnotHandler::OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_
Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
| 560 { | 560 { |
| 561 ASSERT(pAnnot != NULL); | 561 ASSERT(pAnnot != NULL); |
| 562 CFX_ByteString sSubType = pAnnot->GetSubType(); | 562 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 563 | 563 |
| 564 if (sSubType == BFFT_SIGNATURE) | 564 if (sSubType == BFFT_SIGNATURE) |
| 565 { | 565 { |
| 566 } | 566 } |
| 567 else | 567 else |
| 568 { | 568 { |
| 569 if (m_pFormFiller) | 569 if (m_pFormFiller) |
| 570 return m_pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point
); | 570 return m_pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point
); |
| 571 } | 571 } |
| 572 | 572 |
| 573 return FALSE; | 573 return false; |
| 574 } | 574 } |
| 575 FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK
_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 575 bool CPDFSDK_BFAnnotHandler::OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_An
not* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
| 576 { | 576 { |
| 577 ASSERT(pAnnot != NULL); | 577 ASSERT(pAnnot != NULL); |
| 578 CFX_ByteString sSubType = pAnnot->GetSubType(); | 578 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 579 | 579 |
| 580 if (sSubType == BFFT_SIGNATURE) | 580 if (sSubType == BFFT_SIGNATURE) |
| 581 { | 581 { |
| 582 } | 582 } |
| 583 else | 583 else |
| 584 { | 584 { |
| 585 if (m_pFormFiller) | 585 if (m_pFormFiller) |
| 586 return m_pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point); | 586 return m_pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point); |
| 587 } | 587 } |
| 588 | 588 |
| 589 return FALSE; | 589 return false; |
| 590 } | 590 } |
| 591 | 591 |
| 592 FX_BOOL CPDFSDK_BFAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nChar, FX
_DWORD nFlags) | 592 bool CPDFSDK_BFAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nChar, FX_DW
ORD nFlags) |
| 593 { | 593 { |
| 594 ASSERT(pAnnot != NULL); | 594 ASSERT(pAnnot != NULL); |
| 595 CFX_ByteString sSubType = pAnnot->GetSubType(); | 595 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 596 | 596 |
| 597 if (sSubType == BFFT_SIGNATURE) | 597 if (sSubType == BFFT_SIGNATURE) |
| 598 { | 598 { |
| 599 } | 599 } |
| 600 else | 600 else |
| 601 { | 601 { |
| 602 if (m_pFormFiller) | 602 if (m_pFormFiller) |
| 603 return m_pFormFiller->OnChar(pAnnot,nChar, nFlags); | 603 return m_pFormFiller->OnChar(pAnnot,nChar, nFlags); |
| 604 } | 604 } |
| 605 | 605 |
| 606 return FALSE; | 606 return false; |
| 607 } | 607 } |
| 608 | 608 |
| 609 FX_BOOL CPDFSDK_BFAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, i
nt nFlag) | 609 bool CPDFSDK_BFAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int
nFlag) |
| 610 { | 610 { |
| 611 ASSERT(pAnnot != NULL); | 611 ASSERT(pAnnot != NULL); |
| 612 CFX_ByteString sSubType = pAnnot->GetSubType(); | 612 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 613 | 613 |
| 614 if (sSubType == BFFT_SIGNATURE) | 614 if (sSubType == BFFT_SIGNATURE) |
| 615 { | 615 { |
| 616 } | 616 } |
| 617 else | 617 else |
| 618 { | 618 { |
| 619 if (m_pFormFiller) | 619 if (m_pFormFiller) |
| 620 return m_pFormFiller->OnKeyDown(pAnnot,nKeyCode, nFlag); | 620 return m_pFormFiller->OnKeyDown(pAnnot,nKeyCode, nFlag); |
| 621 } | 621 } |
| 622 | 622 |
| 623 return FALSE; | 623 return false; |
| 624 } | 624 } |
| 625 | 625 |
| 626 FX_BOOL CPDFSDK_BFAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int
nFlag) | 626 bool CPDFSDK_BFAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nF
lag) |
| 627 { | 627 { |
| 628 | 628 |
| 629 return FALSE; | 629 return false; |
| 630 } | 630 } |
| 631 void CPDFSDK_BFAnnotHandler::OnCreate(CPDFSDK_Annot* pAnnot) | 631 void CPDFSDK_BFAnnotHandler::OnCreate(CPDFSDK_Annot* pAnnot) |
| 632 { | 632 { |
| 633 ASSERT(pAnnot != NULL); | 633 ASSERT(pAnnot != NULL); |
| 634 CFX_ByteString sSubType = pAnnot->GetSubType(); | 634 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 635 | 635 |
| 636 if (sSubType == BFFT_SIGNATURE) | 636 if (sSubType == BFFT_SIGNATURE) |
| 637 { | 637 { |
| 638 } | 638 } |
| 639 else | 639 else |
| 640 { | 640 { |
| 641 if (m_pFormFiller) | 641 if (m_pFormFiller) |
| 642 m_pFormFiller->OnCreate(pAnnot); | 642 m_pFormFiller->OnCreate(pAnnot); |
| 643 } | 643 } |
| 644 } | 644 } |
| 645 | 645 |
| 646 void CPDFSDK_BFAnnotHandler::OnLoad(CPDFSDK_Annot* pAnnot) | 646 void CPDFSDK_BFAnnotHandler::OnLoad(CPDFSDK_Annot* pAnnot) |
| 647 { | 647 { |
| 648 ASSERT(pAnnot != NULL); | 648 ASSERT(pAnnot != NULL); |
| 649 | 649 |
| 650 CFX_ByteString sSubType = pAnnot->GetSubType(); | 650 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 651 | 651 |
| 652 if (sSubType == BFFT_SIGNATURE) | 652 if (sSubType == BFFT_SIGNATURE) |
| 653 { | 653 { |
| 654 } | 654 } |
| 655 else | 655 else |
| 656 { | 656 { |
| 657 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 657 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 658 if (!pWidget->IsAppearanceValid()) | 658 if (!pWidget->IsAppearanceValid()) |
| 659 pWidget->ResetAppearance(NULL, FALSE); | 659 pWidget->ResetAppearance(NULL, false); |
| 660 | 660 |
| 661 int nFieldType = pWidget->GetFieldType(); | 661 int nFieldType = pWidget->GetFieldType(); |
| 662 if (nFieldType == FIELDTYPE_TEXTFIELD || nFieldType == FIELDTYPE_COMBOBO
X) | 662 if (nFieldType == FIELDTYPE_TEXTFIELD || nFieldType == FIELDTYPE_COMBOBO
X) |
| 663 { | 663 { |
| 664 FX_BOOL bFormated = FALSE; | 664 bool bFormated = false; |
| 665 CFX_WideString sValue = pWidget->OnFormat(bFormated); | 665 CFX_WideString sValue = pWidget->OnFormat(bFormated); |
| 666 if (bFormated && nFieldType == FIELDTYPE_COMBOBOX) | 666 if (bFormated && nFieldType == FIELDTYPE_COMBOBOX) |
| 667 { | 667 { |
| 668 pWidget->ResetAppearance(sValue.c_str(), FALSE); | 668 pWidget->ResetAppearance(sValue.c_str(), false); |
| 669 } | 669 } |
| 670 } | 670 } |
| 671 | 671 |
| 672 if (m_pFormFiller) | 672 if (m_pFormFiller) |
| 673 m_pFormFiller->OnLoad(pAnnot); | 673 m_pFormFiller->OnLoad(pAnnot); |
| 674 } | 674 } |
| 675 } | 675 } |
| 676 | 676 |
| 677 FX_BOOL CPDFSDK_BFAnnotHandler::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag
) | 677 bool CPDFSDK_BFAnnotHandler::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) |
| 678 { | 678 { |
| 679 ASSERT(pAnnot != NULL); | 679 ASSERT(pAnnot != NULL); |
| 680 CFX_ByteString sSubType = pAnnot->GetSubType(); | 680 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 681 | 681 |
| 682 if (sSubType == BFFT_SIGNATURE) | 682 if (sSubType == BFFT_SIGNATURE) |
| 683 { | 683 { |
| 684 } | 684 } |
| 685 else | 685 else |
| 686 { | 686 { |
| 687 if (m_pFormFiller) | 687 if (m_pFormFiller) |
| 688 return m_pFormFiller->OnSetFocus(pAnnot,nFlag); | 688 return m_pFormFiller->OnSetFocus(pAnnot,nFlag); |
| 689 } | 689 } |
| 690 | 690 |
| 691 return TRUE; | 691 return true; |
| 692 } | 692 } |
| 693 FX_BOOL CPDFSDK_BFAnnotHandler::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFla
g) | 693 bool CPDFSDK_BFAnnotHandler::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) |
| 694 { | 694 { |
| 695 ASSERT(pAnnot != NULL); | 695 ASSERT(pAnnot != NULL); |
| 696 CFX_ByteString sSubType = pAnnot->GetSubType(); | 696 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 697 | 697 |
| 698 if (sSubType == BFFT_SIGNATURE) | 698 if (sSubType == BFFT_SIGNATURE) |
| 699 { | 699 { |
| 700 } | 700 } |
| 701 else | 701 else |
| 702 { | 702 { |
| 703 if (m_pFormFiller) | 703 if (m_pFormFiller) |
| 704 return m_pFormFiller->OnKillFocus(pAnnot,nFlag); | 704 return m_pFormFiller->OnKillFocus(pAnnot,nFlag); |
| 705 } | 705 } |
| 706 | 706 |
| 707 return TRUE; | 707 return true; |
| 708 } | 708 } |
| 709 | 709 |
| 710 CPDF_Rect CPDFSDK_BFAnnotHandler::GetViewBBox(CPDFSDK_PageView *pPageView, CPDFS
DK_Annot* pAnnot) | 710 CPDF_Rect CPDFSDK_BFAnnotHandler::GetViewBBox(CPDFSDK_PageView *pPageView, CPDFS
DK_Annot* pAnnot) |
| 711 { | 711 { |
| 712 ASSERT(pAnnot != NULL); | 712 ASSERT(pAnnot != NULL); |
| 713 CFX_ByteString sSubType = pAnnot->GetSubType(); | 713 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 714 | 714 |
| 715 if (sSubType == BFFT_SIGNATURE) | 715 if (sSubType == BFFT_SIGNATURE) |
| 716 { | 716 { |
| 717 } | 717 } |
| 718 else | 718 else |
| 719 { | 719 { |
| 720 if (m_pFormFiller) | 720 if (m_pFormFiller) |
| 721 return m_pFormFiller->GetViewBBox(pPageView, pAnnot); | 721 return m_pFormFiller->GetViewBBox(pPageView, pAnnot); |
| 722 | 722 |
| 723 } | 723 } |
| 724 | 724 |
| 725 return CPDF_Rect(0,0,0,0); | 725 return CPDF_Rect(0,0,0,0); |
| 726 } | 726 } |
| 727 | 727 |
| 728 FX_BOOL CPDFSDK_BFAnnotHandler::HitTest(CPDFSDK_PageView *pPageView, CPDFSDK_Ann
ot* pAnnot, const CPDF_Point& point) | 728 bool CPDFSDK_BFAnnotHandler::HitTest(CPDFSDK_PageView *pPageView, CPDFSDK_Annot*
pAnnot, const CPDF_Point& point) |
| 729 { | 729 { |
| 730 ASSERT(pPageView); | 730 ASSERT(pPageView); |
| 731 ASSERT(pAnnot); | 731 ASSERT(pAnnot); |
| 732 | 732 |
| 733 CPDF_Rect rect = GetViewBBox(pPageView, pAnnot); | 733 CPDF_Rect rect = GetViewBBox(pPageView, pAnnot); |
| 734 return rect.Contains(point.x, point.y); | 734 return rect.Contains(point.x, point.y); |
| 735 } | 735 } |
| 736 | 736 |
| 737 //CReader_AnnotIteratorEx | 737 //CReader_AnnotIteratorEx |
| 738 | 738 |
| 739 CPDFSDK_AnnotIterator::CPDFSDK_AnnotIterator(CPDFSDK_PageView * pPageView,FX_BOO
L bReverse, | 739 CPDFSDK_AnnotIterator::CPDFSDK_AnnotIterator(CPDFSDK_PageView * pPageView,bool b
Reverse, |
| 740 FX_BOOL bIgnoreTopmost/*=FALSE*
/, | 740 bool bIgnoreTopmost/*=false*/, |
| 741 FX_BOOL bCircle/*=FALSE*/, | 741 bool bCircle/*=false*/, |
| 742 CFX_PtrArray *pList/*=NULL*/) | 742 CFX_PtrArray *pList/*=NULL*/) |
| 743 { | 743 { |
| 744 ASSERT(pPageView); | 744 ASSERT(pPageView); |
| 745 m_bReverse=bReverse; | 745 m_bReverse=bReverse; |
| 746 m_bIgnoreTopmost= bIgnoreTopmost; | 746 m_bIgnoreTopmost= bIgnoreTopmost; |
| 747 m_bCircle=bCircle; | 747 m_bCircle=bCircle; |
| 748 m_pIteratorAnnotList.RemoveAll(); | 748 m_pIteratorAnnotList.RemoveAll(); |
| 749 InitIteratorAnnotList(pPageView,pList); | 749 InitIteratorAnnotList(pPageView,pList); |
| 750 } | 750 } |
| 751 | 751 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 int LyOrderCompare(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2) | 874 int LyOrderCompare(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2) |
| 875 { | 875 { |
| 876 if(p1->GetLayoutOrder() < p2->GetLayoutOrder()) | 876 if(p1->GetLayoutOrder() < p2->GetLayoutOrder()) |
| 877 return -1; | 877 return -1; |
| 878 else if (p1->GetLayoutOrder() == p2->GetLayoutOrder()) | 878 else if (p1->GetLayoutOrder() == p2->GetLayoutOrder()) |
| 879 return 0; | 879 return 0; |
| 880 else | 880 else |
| 881 return 1; | 881 return 1; |
| 882 } | 882 } |
| 883 | 883 |
| 884 FX_BOOL CPDFSDK_AnnotIterator::InitIteratorAnnotList(CPDFSDK_PageView* pPageView
,CFX_PtrArray * pAnnotList) | 884 bool CPDFSDK_AnnotIterator::InitIteratorAnnotList(CPDFSDK_PageView* pPageView,CF
X_PtrArray * pAnnotList) |
| 885 { | 885 { |
| 886 ASSERT(pPageView); | 886 ASSERT(pPageView); |
| 887 | 887 |
| 888 if(pAnnotList==NULL){ | 888 if(pAnnotList==NULL){ |
| 889 pAnnotList=pPageView->GetAnnotList(); | 889 pAnnotList=pPageView->GetAnnotList(); |
| 890 } | 890 } |
| 891 | 891 |
| 892 m_pIteratorAnnotList.RemoveAll(); | 892 m_pIteratorAnnotList.RemoveAll(); |
| 893 if(!pAnnotList) return FALSE; | 893 if(!pAnnotList) return false; |
| 894 | 894 |
| 895 CPDFSDK_Annot * pTopMostAnnot= (m_bIgnoreTopmost) ? NULL : pPageView->GetFoc
usAnnot(); | 895 CPDFSDK_Annot * pTopMostAnnot= (m_bIgnoreTopmost) ? NULL : pPageView->GetFoc
usAnnot(); |
| 896 | 896 |
| 897 | 897 |
| 898 int nCount =pAnnotList->GetSize(); | 898 int nCount =pAnnotList->GetSize(); |
| 899 | 899 |
| 900 for(int i = nCount- 1 ;i >= 0;i--) | 900 for(int i = nCount- 1 ;i >= 0;i--) |
| 901 { | 901 { |
| 902 CPDFSDK_Annot * pReaderAnnot= (CPDFSDK_Annot*)pAnnotList->GetAt(i); | 902 CPDFSDK_Annot * pReaderAnnot= (CPDFSDK_Annot*)pAnnotList->GetAt(i); |
| 903 m_pIteratorAnnotList.Add(pReaderAnnot); | 903 m_pIteratorAnnotList.Add(pReaderAnnot); |
| 904 } | 904 } |
| 905 | 905 |
| 906 InsertSort(m_pIteratorAnnotList,&LyOrderCompare); | 906 InsertSort(m_pIteratorAnnotList,&LyOrderCompare); |
| 907 | 907 |
| 908 if(pTopMostAnnot) | 908 if(pTopMostAnnot) |
| 909 { | 909 { |
| 910 for(int i=0 ;i<nCount;i++) | 910 for(int i=0 ;i<nCount;i++) |
| 911 { | 911 { |
| 912 CPDFSDK_Annot * pReaderAnnot = (CPDFSDK_Annot*)m_pIteratorAnnotList.
GetAt(i); | 912 CPDFSDK_Annot * pReaderAnnot = (CPDFSDK_Annot*)m_pIteratorAnnotList.
GetAt(i); |
| 913 if(pReaderAnnot == pTopMostAnnot) | 913 if(pReaderAnnot == pTopMostAnnot) |
| 914 { | 914 { |
| 915 m_pIteratorAnnotList.RemoveAt(i); | 915 m_pIteratorAnnotList.RemoveAt(i); |
| 916 m_pIteratorAnnotList.InsertAt(0, pReaderAnnot); | 916 m_pIteratorAnnotList.InsertAt(0, pReaderAnnot); |
| 917 break; | 917 break; |
| 918 } | 918 } |
| 919 } | 919 } |
| 920 } | 920 } |
| 921 | 921 |
| 922 return TRUE; | 922 return true; |
| 923 } | 923 } |
| OLD | NEW |