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 #ifndef FPDFSDK_INCLUDE_FSDK_MGR_H_ | 7 #ifndef FPDFSDK_INCLUDE_FSDK_MGR_H_ |
8 #define FPDFSDK_INCLUDE_FSDK_MGR_H_ | 8 #define FPDFSDK_INCLUDE_FSDK_MGR_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 | 11 |
12 #include "core/include/fpdftext/fpdf_text.h" | 12 #include "core/include/fpdftext/fpdf_text.h" |
| 13 #ifdef PDF_ENABLE_XFA |
| 14 #include "fpdfxfa/fpdfxfa_doc.h" |
| 15 #include "fpdfxfa/fpdfxfa_page.h" |
| 16 #endif |
13 #include "fsdk_actionhandler.h" | 17 #include "fsdk_actionhandler.h" |
14 #include "fsdk_annothandler.h" | 18 #include "fsdk_annothandler.h" |
15 #include "fsdk_baseannot.h" | 19 #include "fsdk_baseannot.h" |
16 #include "fsdk_baseform.h" | 20 #include "fsdk_baseform.h" |
17 #include "fsdk_common.h" | 21 #include "fsdk_common.h" |
18 #include "fsdk_define.h" | 22 #include "fsdk_define.h" |
19 #include "fx_systemhandler.h" | 23 #include "fx_systemhandler.h" |
20 #include "javascript/IJavaScript.h" | 24 #include "javascript/IJavaScript.h" |
21 #include "public/fpdf_formfill.h" | 25 #include "public/fpdf_formfill.h" |
22 #include "public/fpdf_fwlevent.h" // cross platform keycode and events define. | 26 #include "public/fpdf_fwlevent.h" // cross platform keycode and events define. |
23 #include "third_party/base/nonstd_unique_ptr.h" | 27 #include "third_party/base/nonstd_unique_ptr.h" |
24 | 28 |
25 class CFFL_IFormFiller; | 29 class CFFL_IFormFiller; |
26 class CPDFSDK_ActionHandler; | 30 class CPDFSDK_ActionHandler; |
27 class CPDFSDK_Annot; | 31 class CPDFSDK_Annot; |
28 class CPDFSDK_Document; | 32 class CPDFSDK_Document; |
29 class CPDFSDK_InterForm; | 33 class CPDFSDK_InterForm; |
30 class CPDFSDK_PageView; | 34 class CPDFSDK_PageView; |
31 class CPDFSDK_Widget; | 35 class CPDFSDK_Widget; |
32 class IFX_SystemHandler; | 36 class IFX_SystemHandler; |
33 | 37 |
34 class CPDFDoc_Environment final { | 38 class CPDFDoc_Environment final { |
35 public: | 39 public: |
36 CPDFDoc_Environment(UnderlyingDocumentType* pDoc, FPDF_FORMFILLINFO* pFFinfo); | 40 CPDFDoc_Environment(UnderlyingDocumentType* pDoc, FPDF_FORMFILLINFO* pFFinfo); |
37 ~CPDFDoc_Environment(); | 41 ~CPDFDoc_Environment(); |
38 | 42 |
| 43 #ifdef PDF_ENABLE_XFA |
| 44 void Release() { |
| 45 if (m_pInfo && m_pInfo->Release) |
| 46 m_pInfo->Release(m_pInfo); |
| 47 delete this; |
| 48 } |
| 49 |
| 50 #endif |
39 void FFI_Invalidate(FPDF_PAGE page, | 51 void FFI_Invalidate(FPDF_PAGE page, |
40 double left, | 52 double left, |
41 double top, | 53 double top, |
42 double right, | 54 double right, |
43 double bottom) { | 55 double bottom) { |
44 if (m_pInfo && m_pInfo->FFI_Invalidate) | 56 if (m_pInfo && m_pInfo->FFI_Invalidate) |
45 m_pInfo->FFI_Invalidate(m_pInfo, page, left, top, right, bottom); | 57 m_pInfo->FFI_Invalidate(m_pInfo, page, left, top, right, bottom); |
46 } | 58 } |
47 | 59 |
48 void FFI_OutputSelectedRect(FPDF_PAGE page, | 60 void FFI_OutputSelectedRect(FPDF_PAGE page, |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 205 |
194 void FFI_DoGoToAction(int nPageIndex, | 206 void FFI_DoGoToAction(int nPageIndex, |
195 int zoomMode, | 207 int zoomMode, |
196 float* fPosArray, | 208 float* fPosArray, |
197 int sizeOfArray) { | 209 int sizeOfArray) { |
198 if (m_pInfo && m_pInfo->FFI_DoGoToAction) | 210 if (m_pInfo && m_pInfo->FFI_DoGoToAction) |
199 m_pInfo->FFI_DoGoToAction(m_pInfo, nPageIndex, zoomMode, fPosArray, | 211 m_pInfo->FFI_DoGoToAction(m_pInfo, nPageIndex, zoomMode, fPosArray, |
200 sizeOfArray); | 212 sizeOfArray); |
201 } | 213 } |
202 | 214 |
| 215 #ifdef PDF_ENABLE_XFA |
| 216 void FFI_DisplayCaret(FPDF_PAGE page, |
| 217 FPDF_BOOL bVisible, |
| 218 double left, |
| 219 double top, |
| 220 double right, |
| 221 double bottom) { |
| 222 if (m_pInfo && m_pInfo->FFI_DisplayCaret) |
| 223 m_pInfo->FFI_DisplayCaret(m_pInfo, page, bVisible, left, top, right, |
| 224 bottom); |
| 225 } |
| 226 |
| 227 int FFI_GetCurrentPageIndex(FPDF_DOCUMENT document) { |
| 228 if (!m_pInfo || !m_pInfo->FFI_GetCurrentPageIndex) { |
| 229 return -1; |
| 230 } |
| 231 return m_pInfo->FFI_GetCurrentPageIndex(m_pInfo, document); |
| 232 } |
| 233 |
| 234 void FFI_SetCurrentPage(FPDF_DOCUMENT document, int iCurPage) { |
| 235 if (m_pInfo && m_pInfo->FFI_SetCurrentPage) |
| 236 m_pInfo->FFI_SetCurrentPage(m_pInfo, document, iCurPage); |
| 237 } |
| 238 |
| 239 CFX_WideString FFI_GetAppName() const { return CFX_WideString(L"Acrobat"); } |
| 240 |
| 241 CFX_WideString FFI_GetPlatform() { |
| 242 if (m_pInfo && m_pInfo->FFI_GetPlatform) { |
| 243 int nRequiredLen = m_pInfo->FFI_GetPlatform(m_pInfo, NULL, 0); |
| 244 if (nRequiredLen <= 0) |
| 245 return L""; |
| 246 |
| 247 char* pbuff = new char[nRequiredLen]; |
| 248 memset(pbuff, 0, nRequiredLen); |
| 249 int nActualLen = m_pInfo->FFI_GetPlatform(m_pInfo, pbuff, nRequiredLen); |
| 250 if (nActualLen <= 0 || nActualLen > nRequiredLen) { |
| 251 delete[] pbuff; |
| 252 return L""; |
| 253 } |
| 254 CFX_ByteString bsRet = CFX_ByteString(pbuff, nActualLen); |
| 255 CFX_WideString wsRet = CFX_WideString::FromUTF16LE( |
| 256 (unsigned short*)bsRet.GetBuffer(bsRet.GetLength()), |
| 257 bsRet.GetLength() / sizeof(unsigned short)); |
| 258 delete[] pbuff; |
| 259 return wsRet; |
| 260 } |
| 261 return L""; |
| 262 } |
| 263 |
| 264 void FFI_GotoURL(FPDF_DOCUMENT document, |
| 265 const CFX_WideStringC& wsURL, |
| 266 FX_BOOL bAppend) { |
| 267 if (m_pInfo && m_pInfo->FFI_GotoURL) { |
| 268 CFX_ByteString bsTo = CFX_WideString(wsURL).UTF16LE_Encode(); |
| 269 FPDF_WIDESTRING pTo = (FPDF_WIDESTRING)bsTo.GetBuffer(wsURL.GetLength()); |
| 270 m_pInfo->FFI_GotoURL(m_pInfo, document, pTo); |
| 271 bsTo.ReleaseBuffer(); |
| 272 } |
| 273 } |
| 274 |
| 275 void FFI_GetURL(FPDF_DOCUMENT document, CFX_WideString& wsURL) { |
| 276 wsURL = CFX_WideString(); |
| 277 } |
| 278 |
| 279 void FFI_AddDoRecord(FPDF_DOCUMENT document, FPDF_WIDGET hWidget) {} |
| 280 void FFI_PageEvent(FPDF_PAGE page, FPDF_DWORD flag) {} |
| 281 |
| 282 void FFI_GetPageViewRect(FPDF_PAGE page, FS_RECTF& dstRect) { |
| 283 if (m_pInfo && m_pInfo->FFI_GetPageViewRect) { |
| 284 double left; |
| 285 double top; |
| 286 double right; |
| 287 double bottom; |
| 288 m_pInfo->FFI_GetPageViewRect(m_pInfo, page, &left, &top, &right, &bottom); |
| 289 |
| 290 dstRect.left = static_cast<float>(left); |
| 291 dstRect.top = static_cast<float>(top < bottom ? bottom : top); |
| 292 dstRect.bottom = static_cast<float>(top < bottom ? top : bottom); |
| 293 dstRect.right = static_cast<float>(right); |
| 294 } |
| 295 } |
| 296 |
| 297 FX_BOOL FFI_PopupMenu(FPDF_PAGE page, |
| 298 FPDF_WIDGET hWidget, |
| 299 int menuFlag, |
| 300 CFX_PointF ptPopup, |
| 301 const CFX_PointF* pRectExclude) { |
| 302 if (m_pInfo && m_pInfo->FFI_PopupMenu) |
| 303 return m_pInfo->FFI_PopupMenu(m_pInfo, page, hWidget, menuFlag, ptPopup.x, |
| 304 ptPopup.y); |
| 305 return FALSE; |
| 306 } |
| 307 |
| 308 void FFI_Alert(FPDF_WIDESTRING Msg, |
| 309 FPDF_WIDESTRING Title, |
| 310 int Type, |
| 311 int Icon) { |
| 312 if (m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->app_alert) |
| 313 m_pInfo->m_pJsPlatform->app_alert(m_pInfo->m_pJsPlatform, Msg, Title, |
| 314 Type, Icon); |
| 315 } |
| 316 |
| 317 void FFI_EmailTo(FPDF_FILEHANDLER* fileHandler, |
| 318 FPDF_WIDESTRING pTo, |
| 319 FPDF_WIDESTRING pSubject, |
| 320 FPDF_WIDESTRING pCC, |
| 321 FPDF_WIDESTRING pBcc, |
| 322 FPDF_WIDESTRING pMsg) { |
| 323 if (m_pInfo && m_pInfo->FFI_EmailTo) |
| 324 m_pInfo->FFI_EmailTo(m_pInfo, fileHandler, pTo, pSubject, pCC, pBcc, |
| 325 pMsg); |
| 326 } |
| 327 |
| 328 void FFI_UploadTo(FPDF_FILEHANDLER* fileHandler, |
| 329 int fileFlag, |
| 330 FPDF_WIDESTRING uploadTo) { |
| 331 if (m_pInfo && m_pInfo->FFI_UploadTo) |
| 332 m_pInfo->FFI_UploadTo(m_pInfo, fileHandler, fileFlag, uploadTo); |
| 333 } |
| 334 |
| 335 FPDF_FILEHANDLER* FFI_OpenFile(int fileType, |
| 336 FPDF_WIDESTRING wsURL, |
| 337 const char* mode) { |
| 338 if (m_pInfo && m_pInfo->FFI_OpenFile) |
| 339 return m_pInfo->FFI_OpenFile(m_pInfo, fileType, wsURL, mode); |
| 340 return NULL; |
| 341 } |
| 342 |
| 343 CFX_WideString FFI_GetFilePath(FPDF_FILEHANDLER* pFileHandler) const { |
| 344 return L""; |
| 345 } |
| 346 |
| 347 int FFI_GetDocumentCount() const { return 0; } |
| 348 int FFI_GetCurDocument() const { return 0; } |
| 349 |
| 350 IFX_FileRead* FFI_DownloadFromURL(const FX_WCHAR* url) { |
| 351 if (m_pInfo && m_pInfo->FFI_DownloadFromURL) { |
| 352 CFX_ByteString bstrURL = CFX_WideString(url).UTF16LE_Encode(); |
| 353 FPDF_WIDESTRING wsURL = |
| 354 (FPDF_WIDESTRING)bstrURL.GetBuffer(bstrURL.GetLength()); |
| 355 |
| 356 FPDF_LPFILEHANDLER fileHandler = |
| 357 m_pInfo->FFI_DownloadFromURL(m_pInfo, wsURL); |
| 358 |
| 359 return new CFPDF_FileStream(fileHandler); |
| 360 } |
| 361 return NULL; |
| 362 } |
| 363 |
| 364 CFX_WideString FFI_PostRequestURL(const FX_WCHAR* wsURL, |
| 365 const FX_WCHAR* wsData, |
| 366 const FX_WCHAR* wsContentType, |
| 367 const FX_WCHAR* wsEncode, |
| 368 const FX_WCHAR* wsHeader) { |
| 369 if (m_pInfo && m_pInfo->FFI_PostRequestURL) { |
| 370 CFX_ByteString bsURL = CFX_WideString(wsURL).UTF16LE_Encode(); |
| 371 FPDF_WIDESTRING URL = (FPDF_WIDESTRING)bsURL.GetBuffer(bsURL.GetLength()); |
| 372 |
| 373 CFX_ByteString bsData = CFX_WideString(wsData).UTF16LE_Encode(); |
| 374 FPDF_WIDESTRING data = |
| 375 (FPDF_WIDESTRING)bsData.GetBuffer(bsData.GetLength()); |
| 376 |
| 377 CFX_ByteString bsContentType = |
| 378 CFX_WideString(wsContentType).UTF16LE_Encode(); |
| 379 FPDF_WIDESTRING contentType = |
| 380 (FPDF_WIDESTRING)bsContentType.GetBuffer(bsContentType.GetLength()); |
| 381 |
| 382 CFX_ByteString bsEncode = CFX_WideString(wsEncode).UTF16LE_Encode(); |
| 383 FPDF_WIDESTRING encode = |
| 384 (FPDF_WIDESTRING)bsEncode.GetBuffer(bsEncode.GetLength()); |
| 385 |
| 386 CFX_ByteString bsHeader = CFX_WideString(wsHeader).UTF16LE_Encode(); |
| 387 FPDF_WIDESTRING header = |
| 388 (FPDF_WIDESTRING)bsHeader.GetBuffer(bsHeader.GetLength()); |
| 389 |
| 390 FPDF_BSTR respone; |
| 391 FPDF_BStr_Init(&respone); |
| 392 m_pInfo->FFI_PostRequestURL(m_pInfo, URL, data, contentType, encode, |
| 393 header, &respone); |
| 394 |
| 395 CFX_WideString wsRet = CFX_WideString::FromUTF16LE( |
| 396 (unsigned short*)respone.str, respone.len / sizeof(unsigned short)); |
| 397 FPDF_BStr_Clear(&respone); |
| 398 |
| 399 return wsRet; |
| 400 } |
| 401 return L""; |
| 402 } |
| 403 |
| 404 FPDF_BOOL FFI_PutRequestURL(const FX_WCHAR* wsURL, |
| 405 const FX_WCHAR* wsData, |
| 406 const FX_WCHAR* wsEncode) { |
| 407 if (m_pInfo && m_pInfo->FFI_PutRequestURL) { |
| 408 CFX_ByteString bsURL = CFX_WideString(wsURL).UTF16LE_Encode(); |
| 409 FPDF_WIDESTRING URL = (FPDF_WIDESTRING)bsURL.GetBuffer(bsURL.GetLength()); |
| 410 |
| 411 CFX_ByteString bsData = CFX_WideString(wsData).UTF16LE_Encode(); |
| 412 FPDF_WIDESTRING data = |
| 413 (FPDF_WIDESTRING)bsData.GetBuffer(bsData.GetLength()); |
| 414 |
| 415 CFX_ByteString bsEncode = CFX_WideString(wsEncode).UTF16LE_Encode(); |
| 416 FPDF_WIDESTRING encode = |
| 417 (FPDF_WIDESTRING)bsEncode.GetBuffer(bsEncode.GetLength()); |
| 418 |
| 419 return m_pInfo->FFI_PutRequestURL(m_pInfo, URL, data, encode); |
| 420 } |
| 421 return FALSE; |
| 422 } |
| 423 |
| 424 FPDF_BOOL FFI_ShowFileDialog(const FX_WCHAR* wsTitle, |
| 425 const FX_WCHAR* wsFilter, |
| 426 CFX_WideStringArray& wsPathArr, |
| 427 FX_BOOL bOpen) { |
| 428 return FALSE; |
| 429 } |
| 430 |
| 431 CFX_WideString FFI_GetLanguage() { |
| 432 if (m_pInfo && m_pInfo->FFI_GetLanguage) { |
| 433 int nRequiredLen = m_pInfo->FFI_GetLanguage(m_pInfo, NULL, 0); |
| 434 if (nRequiredLen <= 0) |
| 435 return L""; |
| 436 |
| 437 char* pbuff = new char[nRequiredLen]; |
| 438 memset(pbuff, 0, nRequiredLen); |
| 439 int nActualLen = m_pInfo->FFI_GetLanguage(m_pInfo, pbuff, nRequiredLen); |
| 440 if (nActualLen <= 0 || nActualLen > nRequiredLen) { |
| 441 delete[] pbuff; |
| 442 return L""; |
| 443 } |
| 444 CFX_ByteString bsRet = CFX_ByteString(pbuff, nActualLen); |
| 445 CFX_WideString wsRet = CFX_WideString::FromUTF16LE( |
| 446 (unsigned short*)bsRet.GetBuffer(bsRet.GetLength()), |
| 447 bsRet.GetLength() / sizeof(unsigned short)); |
| 448 delete[] pbuff; |
| 449 return wsRet; |
| 450 } |
| 451 return L""; |
| 452 } |
| 453 |
| 454 #endif |
203 FX_BOOL IsJSInitiated() const { return m_pInfo && m_pInfo->m_pJsPlatform; } | 455 FX_BOOL IsJSInitiated() const { return m_pInfo && m_pInfo->m_pJsPlatform; } |
204 void SetSDKDocument(CPDFSDK_Document* pFXDoc) { m_pSDKDoc = pFXDoc; } | 456 void SetSDKDocument(CPDFSDK_Document* pFXDoc) { m_pSDKDoc = pFXDoc; } |
205 CPDFSDK_Document* GetSDKDocument() const { return m_pSDKDoc; } | 457 CPDFSDK_Document* GetSDKDocument() const { return m_pSDKDoc; } |
206 UnderlyingDocumentType* GetUnderlyingDocument() const { | 458 UnderlyingDocumentType* GetUnderlyingDocument() const { |
207 return m_pUnderlyingDoc; | 459 return m_pUnderlyingDoc; |
208 } | 460 } |
209 CFX_ByteString GetAppName() const { return ""; } | 461 CFX_ByteString GetAppName() const { return ""; } |
210 IFX_SystemHandler* GetSysHandler() const { return m_pSysHandler.get(); } | 462 IFX_SystemHandler* GetSysHandler() const { return m_pSysHandler.get(); } |
211 FPDF_FORMFILLINFO* GetFormFillInfo() const { return m_pInfo; } | 463 FPDF_FORMFILLINFO* GetFormFillInfo() const { return m_pInfo; } |
212 | 464 |
(...skipping 16 matching lines...) Expand all Loading... |
229 class CPDFSDK_Document { | 481 class CPDFSDK_Document { |
230 public: | 482 public: |
231 CPDFSDK_Document(UnderlyingDocumentType* pDoc, CPDFDoc_Environment* pEnv); | 483 CPDFSDK_Document(UnderlyingDocumentType* pDoc, CPDFDoc_Environment* pEnv); |
232 ~CPDFSDK_Document(); | 484 ~CPDFSDK_Document(); |
233 | 485 |
234 CPDFSDK_InterForm* GetInterForm(); | 486 CPDFSDK_InterForm* GetInterForm(); |
235 | 487 |
236 // Gets the document object for the next layer down; for master this is | 488 // Gets the document object for the next layer down; for master this is |
237 // a CPDF_Document, but for XFA it is a CPDFXFA_Document. | 489 // a CPDF_Document, but for XFA it is a CPDFXFA_Document. |
238 UnderlyingDocumentType* GetUnderlyingDocument() const { | 490 UnderlyingDocumentType* GetUnderlyingDocument() const { |
| 491 #ifndef PDF_ENABLE_XFA |
239 return GetPDFDocument(); | 492 return GetPDFDocument(); |
| 493 #else |
| 494 return GetXFADocument(); |
| 495 #endif |
240 } | 496 } |
241 | 497 |
242 // Gets the CPDF_Document, either directly in master, or from the | 498 // Gets the CPDF_Document, either directly in master, or from the |
243 // CPDFXFA_Document for XFA. | 499 // CPDFXFA_Document for XFA. |
| 500 #ifndef PDF_ENABLE_XFA |
244 CPDF_Document* GetPDFDocument() const { return m_pDoc; } | 501 CPDF_Document* GetPDFDocument() const { return m_pDoc; } |
| 502 #else |
| 503 CPDF_Document* GetPDFDocument() const { |
| 504 return m_pDoc ? m_pDoc->GetPDFDoc() : nullptr; |
| 505 } |
245 | 506 |
| 507 // Gets the XFA document directly (XFA-only). |
| 508 CPDFXFA_Document* GetXFADocument() const { return m_pDoc; } |
| 509 #endif |
| 510 |
| 511 #ifdef PDF_ENABLE_XFA |
| 512 int GetPageViewCount() const { return m_pageMap.size(); } |
| 513 #endif |
246 CPDFSDK_PageView* GetPageView(UnderlyingPageType* pPage, | 514 CPDFSDK_PageView* GetPageView(UnderlyingPageType* pPage, |
247 FX_BOOL ReNew = TRUE); | 515 FX_BOOL ReNew = TRUE); |
248 CPDFSDK_PageView* GetPageView(int nIndex); | 516 CPDFSDK_PageView* GetPageView(int nIndex); |
249 CPDFSDK_PageView* GetCurrentView(); | 517 CPDFSDK_PageView* GetCurrentView(); |
250 void RemovePageView(UnderlyingPageType* pPage); | 518 void RemovePageView(UnderlyingPageType* pPage); |
251 void UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_Annot* pAnnot); | 519 void UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_Annot* pAnnot); |
252 | 520 |
253 CPDFSDK_Annot* GetFocusAnnot(); | 521 CPDFSDK_Annot* GetFocusAnnot(); |
254 | 522 |
255 IJS_Runtime* GetJsRuntime(); | 523 IJS_Runtime* GetJsRuntime(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 nonstd::unique_ptr<CPDF_OCContext> m_pOccontent; | 557 nonstd::unique_ptr<CPDF_OCContext> m_pOccontent; |
290 FX_BOOL m_bChangeMask; | 558 FX_BOOL m_bChangeMask; |
291 FX_BOOL m_bBeingDestroyed; | 559 FX_BOOL m_bBeingDestroyed; |
292 }; | 560 }; |
293 class CPDFSDK_PageView final { | 561 class CPDFSDK_PageView final { |
294 public: | 562 public: |
295 CPDFSDK_PageView(CPDFSDK_Document* pSDKDoc, UnderlyingPageType* page); | 563 CPDFSDK_PageView(CPDFSDK_Document* pSDKDoc, UnderlyingPageType* page); |
296 ~CPDFSDK_PageView(); | 564 ~CPDFSDK_PageView(); |
297 void PageView_OnDraw(CFX_RenderDevice* pDevice, | 565 void PageView_OnDraw(CFX_RenderDevice* pDevice, |
298 CPDF_Matrix* pUser2Device, | 566 CPDF_Matrix* pUser2Device, |
| 567 #ifndef PDF_ENABLE_XFA |
299 CPDF_RenderOptions* pOptions); | 568 CPDF_RenderOptions* pOptions); |
| 569 #else |
| 570 CPDF_RenderOptions* pOptions, |
| 571 const FX_RECT& pClip); |
| 572 #endif |
300 const CPDF_Annot* GetPDFAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); | 573 const CPDF_Annot* GetPDFAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); |
301 CPDFSDK_Annot* GetFXAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); | 574 CPDFSDK_Annot* GetFXAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); |
302 const CPDF_Annot* GetPDFWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); | 575 const CPDF_Annot* GetPDFWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); |
303 CPDFSDK_Annot* GetFXWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); | 576 CPDFSDK_Annot* GetFXWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); |
304 CPDFSDK_Annot* GetFocusAnnot(); | 577 CPDFSDK_Annot* GetFocusAnnot(); |
305 void SetFocusAnnot(CPDFSDK_Annot* pSDKAnnot, FX_UINT nFlag = 0) { | 578 void SetFocusAnnot(CPDFSDK_Annot* pSDKAnnot, FX_UINT nFlag = 0) { |
306 m_pSDKDoc->SetFocusAnnot(pSDKAnnot, nFlag); | 579 m_pSDKDoc->SetFocusAnnot(pSDKAnnot, nFlag); |
307 } | 580 } |
308 FX_BOOL KillFocusAnnot(FX_UINT nFlag = 0) { | 581 FX_BOOL KillFocusAnnot(FX_UINT nFlag = 0) { |
309 return m_pSDKDoc->KillFocusAnnot(nFlag); | 582 return m_pSDKDoc->KillFocusAnnot(nFlag); |
310 } | 583 } |
311 void KillFocusAnnotIfNeeded(); | 584 void KillFocusAnnotIfNeeded(); |
312 FX_BOOL Annot_HasAppearance(CPDF_Annot* pAnnot); | 585 FX_BOOL Annot_HasAppearance(CPDF_Annot* pAnnot); |
313 | 586 |
314 CPDFSDK_Annot* AddAnnot(CPDF_Dictionary* pDict); | 587 CPDFSDK_Annot* AddAnnot(CPDF_Dictionary* pDict); |
315 CPDFSDK_Annot* AddAnnot(const FX_CHAR* lpSubType, CPDF_Dictionary* pDict); | 588 CPDFSDK_Annot* AddAnnot(const FX_CHAR* lpSubType, CPDF_Dictionary* pDict); |
316 CPDFSDK_Annot* AddAnnot(CPDF_Annot* pPDFAnnot); | 589 CPDFSDK_Annot* AddAnnot(CPDF_Annot* pPDFAnnot); |
| 590 #ifdef PDF_ENABLE_XFA |
| 591 CPDFSDK_Annot* AddAnnot(IXFA_Widget* pPDFAnnot); |
| 592 #endif |
317 FX_BOOL DeleteAnnot(CPDFSDK_Annot* pAnnot); | 593 FX_BOOL DeleteAnnot(CPDFSDK_Annot* pAnnot); |
318 size_t CountAnnots() const; | 594 size_t CountAnnots() const; |
319 CPDFSDK_Annot* GetAnnot(size_t nIndex); | 595 CPDFSDK_Annot* GetAnnot(size_t nIndex); |
320 CPDFSDK_Annot* GetAnnotByDict(CPDF_Dictionary* pDict); | 596 CPDFSDK_Annot* GetAnnotByDict(CPDF_Dictionary* pDict); |
| 597 #ifndef PDF_ENABLE_XFA |
321 CPDF_Page* GetPDFPage() { return m_page; } | 598 CPDF_Page* GetPDFPage() { return m_page; } |
| 599 #else |
| 600 CPDFSDK_Annot* GetAnnotByXFAWidget(IXFA_Widget* hWidget); |
| 601 CPDFXFA_Page* GetPDFXFAPage() { return m_page; } |
| 602 CPDF_Page* GetPDFPage(); |
| 603 #endif |
322 CPDF_Document* GetPDFDocument(); | 604 CPDF_Document* GetPDFDocument(); |
323 CPDFSDK_Document* GetSDKDocument() { return m_pSDKDoc; } | 605 CPDFSDK_Document* GetSDKDocument() { return m_pSDKDoc; } |
324 FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_UINT nFlag); | 606 FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_UINT nFlag); |
325 FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_UINT nFlag); | 607 FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_UINT nFlag); |
| 608 #ifdef PDF_ENABLE_XFA |
| 609 FX_BOOL OnRButtonDown(const CPDF_Point& point, FX_UINT nFlag); |
| 610 FX_BOOL OnRButtonUp(const CPDF_Point& point, FX_UINT nFlag); |
| 611 #endif |
326 FX_BOOL OnChar(int nChar, FX_UINT nFlag); | 612 FX_BOOL OnChar(int nChar, FX_UINT nFlag); |
327 FX_BOOL OnKeyDown(int nKeyCode, int nFlag); | 613 FX_BOOL OnKeyDown(int nKeyCode, int nFlag); |
328 FX_BOOL OnKeyUp(int nKeyCode, int nFlag); | 614 FX_BOOL OnKeyUp(int nKeyCode, int nFlag); |
329 | 615 |
330 FX_BOOL OnMouseMove(const CPDF_Point& point, int nFlag); | 616 FX_BOOL OnMouseMove(const CPDF_Point& point, int nFlag); |
331 FX_BOOL OnMouseWheel(double deltaX, | 617 FX_BOOL OnMouseWheel(double deltaX, |
332 double deltaY, | 618 double deltaY, |
333 const CPDF_Point& point, | 619 const CPDF_Point& point, |
334 int nFlag); | 620 int nFlag); |
335 bool IsValidAnnot(const CPDF_Annot* p) const; | 621 bool IsValidAnnot(const CPDF_Annot* p) const; |
336 void GetCurrentMatrix(CPDF_Matrix& matrix) { matrix = m_curMatrix; } | 622 void GetCurrentMatrix(CPDF_Matrix& matrix) { matrix = m_curMatrix; } |
337 void UpdateRects(CFX_RectArray& rects); | 623 void UpdateRects(CFX_RectArray& rects); |
338 void UpdateView(CPDFSDK_Annot* pAnnot); | 624 void UpdateView(CPDFSDK_Annot* pAnnot); |
339 const std::vector<CPDFSDK_Annot*>& GetAnnotList() const { | 625 const std::vector<CPDFSDK_Annot*>& GetAnnotList() const { |
340 return m_fxAnnotArray; | 626 return m_fxAnnotArray; |
341 } | 627 } |
342 | 628 |
343 int GetPageIndex(); | 629 int GetPageIndex(); |
344 void LoadFXAnnots(); | 630 void LoadFXAnnots(); |
345 void SetValid(FX_BOOL bValid) { m_bValid = bValid; } | 631 void SetValid(FX_BOOL bValid) { m_bValid = bValid; } |
346 FX_BOOL IsValid() { return m_bValid; } | 632 FX_BOOL IsValid() { return m_bValid; } |
347 void SetLock(FX_BOOL bLocked) { m_bLocked = bLocked; } | 633 void SetLock(FX_BOOL bLocked) { m_bLocked = bLocked; } |
348 FX_BOOL IsLocked() { return m_bLocked; } | 634 FX_BOOL IsLocked() { return m_bLocked; } |
| 635 #ifndef PDF_ENABLE_XFA |
349 void TakeOverPage() { m_bTakeOverPage = TRUE; } | 636 void TakeOverPage() { m_bTakeOverPage = TRUE; } |
| 637 #endif |
350 | 638 |
351 private: | 639 private: |
352 void PageView_OnHighlightFormFields(CFX_RenderDevice* pDevice, | 640 void PageView_OnHighlightFormFields(CFX_RenderDevice* pDevice, |
353 CPDFSDK_Widget* pWidget); | 641 CPDFSDK_Widget* pWidget); |
354 | 642 |
355 CPDF_Matrix m_curMatrix; | 643 CPDF_Matrix m_curMatrix; |
356 UnderlyingPageType* m_page; | 644 UnderlyingPageType* m_page; |
357 nonstd::unique_ptr<CPDF_AnnotList> m_pAnnotList; | 645 nonstd::unique_ptr<CPDF_AnnotList> m_pAnnotList; |
358 std::vector<CPDFSDK_Annot*> m_fxAnnotArray; | 646 std::vector<CPDFSDK_Annot*> m_fxAnnotArray; |
359 CPDFSDK_Document* m_pSDKDoc; | 647 CPDFSDK_Document* m_pSDKDoc; |
| 648 #ifndef PDF_ENABLE_XFA |
360 CPDFSDK_Widget* m_CaptureWidget; | 649 CPDFSDK_Widget* m_CaptureWidget; |
| 650 #else |
| 651 CPDFSDK_Annot* m_CaptureWidget; |
| 652 #endif |
361 FX_BOOL m_bEnterWidget; | 653 FX_BOOL m_bEnterWidget; |
362 FX_BOOL m_bExitWidget; | 654 FX_BOOL m_bExitWidget; |
363 FX_BOOL m_bOnWidget; | 655 FX_BOOL m_bOnWidget; |
364 FX_BOOL m_bValid; | 656 FX_BOOL m_bValid; |
365 FX_BOOL m_bLocked; | 657 FX_BOOL m_bLocked; |
| 658 #ifndef PDF_ENABLE_XFA |
366 FX_BOOL m_bTakeOverPage; | 659 FX_BOOL m_bTakeOverPage; |
| 660 #endif |
367 }; | 661 }; |
368 | 662 |
369 template <class TYPE> | 663 template <class TYPE> |
370 class CGW_ArrayTemplate : public CFX_ArrayTemplate<TYPE> { | 664 class CGW_ArrayTemplate : public CFX_ArrayTemplate<TYPE> { |
371 public: | 665 public: |
372 CGW_ArrayTemplate() {} | 666 CGW_ArrayTemplate() {} |
373 ~CGW_ArrayTemplate() {} | 667 ~CGW_ArrayTemplate() {} |
374 | 668 |
375 typedef int (*LP_COMPARE)(TYPE p1, TYPE p2); | 669 typedef int (*LP_COMPARE)(TYPE p1, TYPE p2); |
376 | 670 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 } | 727 } |
434 | 728 |
435 if (nStartPos < m) | 729 if (nStartPos < m) |
436 QuickSort(nStartPos, m, bAscend, pCompare); | 730 QuickSort(nStartPos, m, bAscend, pCompare); |
437 if (nStopPos > m) | 731 if (nStopPos > m) |
438 QuickSort(m, nStopPos, bAscend, pCompare); | 732 QuickSort(m, nStopPos, bAscend, pCompare); |
439 } | 733 } |
440 }; | 734 }; |
441 | 735 |
442 #endif // FPDFSDK_INCLUDE_FSDK_MGR_H_ | 736 #endif // FPDFSDK_INCLUDE_FSDK_MGR_H_ |
OLD | NEW |