Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(772)

Side by Side Diff: core/include/fpdfdoc/fpdf_doc.h

Issue 1425093003: Clean up CPDF_AnnotList. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: revert error Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | core/src/fpdfdoc/doc_annot.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 CORE_INCLUDE_FPDFDOC_FPDF_DOC_H_ 7 #ifndef CORE_INCLUDE_FPDFDOC_FPDF_DOC_H_
8 #define CORE_INCLUDE_FPDFDOC_FPDF_DOC_H_ 8 #define CORE_INCLUDE_FPDFDOC_FPDF_DOC_H_
9 9
10 #include <map> 10 #include <map>
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 387
388 CPDF_Annot(CPDF_Dictionary* pDict, CPDF_AnnotList* pList); 388 CPDF_Annot(CPDF_Dictionary* pDict, CPDF_AnnotList* pList);
389 ~CPDF_Annot(); 389 ~CPDF_Annot();
390 390
391 CFX_ByteString GetSubType() const; 391 CFX_ByteString GetSubType() const;
392 392
393 FX_DWORD GetFlags() const; 393 FX_DWORD GetFlags() const;
394 394
395 void GetRect(CFX_FloatRect& rect) const; 395 void GetRect(CFX_FloatRect& rect) const;
396 396
397 CPDF_Dictionary* GetAnnotDict(); 397 const CPDF_Dictionary* GetAnnotDict() const { return m_pAnnotDict; }
398 CPDF_Dictionary* GetAnnotDict() { return m_pAnnotDict; }
398 399
399 FX_BOOL DrawAppearance(const CPDF_Page* pPage, 400 FX_BOOL DrawAppearance(const CPDF_Page* pPage,
400 CFX_RenderDevice* pDevice, 401 CFX_RenderDevice* pDevice,
401 const CFX_AffineMatrix* pUser2Device, 402 const CFX_AffineMatrix* pUser2Device,
402 AppearanceMode mode, 403 AppearanceMode mode,
403 const CPDF_RenderOptions* pOptions); 404 const CPDF_RenderOptions* pOptions);
404 405
405 FX_BOOL DrawInContext(const CPDF_Page* pPage, 406 FX_BOOL DrawInContext(const CPDF_Page* pPage,
406 const CPDF_RenderContext* pContext, 407 const CPDF_RenderContext* pContext,
407 const CFX_AffineMatrix* pUser2Device, 408 const CFX_AffineMatrix* pUser2Device,
(...skipping 12 matching lines...) Expand all
420 421
421 CPDF_AnnotList* const m_pList; 422 CPDF_AnnotList* const m_pList;
422 423
423 const CFX_ByteString m_sSubtype; 424 const CFX_ByteString m_sSubtype;
424 425
425 CFX_MapPtrToPtr m_APMap; 426 CFX_MapPtrToPtr m_APMap;
426 }; 427 };
427 428
428 class CPDF_AnnotList { 429 class CPDF_AnnotList {
429 public: 430 public:
430 CPDF_AnnotList(CPDF_Page* pPage); 431 explicit CPDF_AnnotList(CPDF_Page* pPage);
431
432 ~CPDF_AnnotList(); 432 ~CPDF_AnnotList();
433 433
434 void GetAnnotMatrix(const CPDF_Dictionary* pAnnotDict,
435 const CFX_Matrix* pUser2Device,
436 CFX_Matrix& matrix) const;
437
438 void GetAnnotRect(const CPDF_Dictionary* pAnnotDict,
439 const CFX_Matrix* pUser2Device,
440 CPDF_Rect& rtAnnot) const;
441
442 void DisplayAnnots(const CPDF_Page* pPage,
443 CFX_RenderDevice* pDevice,
444 CFX_AffineMatrix* pMatrix,
445 FX_BOOL bShowWidget,
446 CPDF_RenderOptions* pOptions);
447
448 void DisplayAnnots(const CPDF_Page* pPage, 434 void DisplayAnnots(const CPDF_Page* pPage,
449 CPDF_RenderContext* pContext, 435 CPDF_RenderContext* pContext,
450 FX_BOOL bPrinting, 436 FX_BOOL bPrinting,
451 CFX_AffineMatrix* pMatrix, 437 CFX_AffineMatrix* pMatrix,
452 FX_BOOL bShowWidget, 438 FX_BOOL bShowWidget,
453 CPDF_RenderOptions* pOptions) { 439 CPDF_RenderOptions* pOptions) {
454 DisplayAnnots(pPage, NULL, pContext, bPrinting, pMatrix, 440 DisplayAnnots(pPage, nullptr, pContext, bPrinting, pMatrix,
455 bShowWidget ? 3 : 1, pOptions, NULL); 441 bShowWidget ? 3 : 1, pOptions, nullptr);
456 } 442 }
457
458 void DisplayAnnots(const CPDF_Page* pPage,
459 CPDF_RenderContext* pContext,
460 FX_BOOL bPrinting,
461 CFX_AffineMatrix* pMatrix,
462 FX_BOOL bShowWidget,
463 CPDF_RenderOptions* pOptions,
464 FX_RECT* pClipRect) {
465 DisplayAnnots(pPage, NULL, pContext, bPrinting, pMatrix,
466 bShowWidget ? 3 : 1, pOptions, pClipRect);
467 }
468
469 void DisplayAnnots(const CPDF_Page* pPage, 443 void DisplayAnnots(const CPDF_Page* pPage,
470 CFX_RenderDevice* pDevice, 444 CFX_RenderDevice* pDevice,
471 CPDF_RenderContext* pContext, 445 CPDF_RenderContext* pContext,
472 FX_BOOL bPrinting, 446 FX_BOOL bPrinting,
473 CFX_AffineMatrix* pMatrix, 447 CFX_AffineMatrix* pMatrix,
474 FX_DWORD dwAnnotFlags, 448 FX_DWORD dwAnnotFlags,
475 CPDF_RenderOptions* pOptions, 449 CPDF_RenderOptions* pOptions,
476 FX_RECT* pClipRect); 450 FX_RECT* pClipRect);
477 451 size_t Count() const { return m_AnnotList.size(); }
478 CPDF_Annot* GetAt(int index) { return (CPDF_Annot*)m_AnnotList.GetAt(index); } 452 CPDF_Annot* GetAt(size_t index) const { return m_AnnotList[index]; }
479 453 const std::vector<CPDF_Annot*>& All() const { return m_AnnotList; }
480 int Count() { return m_AnnotList.GetSize(); }
481
482 int GetIndex(CPDF_Annot* pAnnot);
483
484 CPDF_Document* GetDocument() const { return m_pDocument; } 454 CPDF_Document* GetDocument() const { return m_pDocument; }
485 455
486 protected: 456 protected:
487 CFX_PtrArray m_AnnotList;
488
489 CPDF_Dictionary* m_pPageDict;
490
491 CPDF_Document* m_pDocument;
492
493 CFX_PtrArray m_Borders;
494
495 void DisplayPass(const CPDF_Page* pPage, 457 void DisplayPass(const CPDF_Page* pPage,
496 CFX_RenderDevice* pDevice, 458 CFX_RenderDevice* pDevice,
497 CPDF_RenderContext* pContext, 459 CPDF_RenderContext* pContext,
498 FX_BOOL bPrinting, 460 FX_BOOL bPrinting,
499 CFX_AffineMatrix* pMatrix, 461 CFX_AffineMatrix* pMatrix,
500 FX_BOOL bWidget, 462 FX_BOOL bWidget,
501 CPDF_RenderOptions* pOptions, 463 CPDF_RenderOptions* pOptions,
502 FX_RECT* clip_rect); 464 FX_RECT* clip_rect);
503 friend class CPDF_Annot; 465
466 CPDF_Document* const m_pDocument;
467 std::vector<CPDF_Annot*> m_AnnotList;
504 }; 468 };
469
505 #define COLORTYPE_TRANSPARENT 0 470 #define COLORTYPE_TRANSPARENT 0
506 #define COLORTYPE_GRAY 1 471 #define COLORTYPE_GRAY 1
507 #define COLORTYPE_RGB 2 472 #define COLORTYPE_RGB 2
508 #define COLORTYPE_CMYK 3 473 #define COLORTYPE_CMYK 3
509 class CPDF_DefaultAppearance { 474 class CPDF_DefaultAppearance {
510 public: 475 public:
511 CPDF_DefaultAppearance(const CFX_ByteString& csDA = "") { m_csDA = csDA; } 476 CPDF_DefaultAppearance(const CFX_ByteString& csDA = "") { m_csDA = csDA; }
512 477
513 CPDF_DefaultAppearance(const CPDF_DefaultAppearance& cDA) { 478 CPDF_DefaultAppearance(const CPDF_DefaultAppearance& cDA) {
514 m_csDA = (CFX_ByteString)(CPDF_DefaultAppearance&)cDA; 479 m_csDA = (CFX_ByteString)(CPDF_DefaultAppearance&)cDA;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 581
617 FX_BOOL IsValidFormField(const void* pField); 582 FX_BOOL IsValidFormField(const void* pField);
618 583
619 CPDF_FormField* GetFieldByDict(CPDF_Dictionary* pFieldDict) const; 584 CPDF_FormField* GetFieldByDict(CPDF_Dictionary* pFieldDict) const;
620 585
621 CPDF_FormControl* GetControlAtPoint(CPDF_Page* pPage, 586 CPDF_FormControl* GetControlAtPoint(CPDF_Page* pPage,
622 FX_FLOAT pdf_x, 587 FX_FLOAT pdf_x,
623 FX_FLOAT pdf_y, 588 FX_FLOAT pdf_y,
624 int* z_order) const; 589 int* z_order) const;
625 590
626 CPDF_FormControl* GetControlByDict(CPDF_Dictionary* pWidgetDict) const; 591 CPDF_FormControl* GetControlByDict(const CPDF_Dictionary* pWidgetDict) const;
627 592
628 CPDF_Document* GetDocument() const { return m_pDocument; } 593 CPDF_Document* GetDocument() const { return m_pDocument; }
629 594
630 CPDF_Dictionary* GetFormDict() const { return m_pFormDict; } 595 CPDF_Dictionary* GetFormDict() const { return m_pFormDict; }
631 596
632 FX_BOOL NeedConstructAP(); 597 FX_BOOL NeedConstructAP();
633 598
634 void NeedConstructAP(FX_BOOL bNeedAP); 599 void NeedConstructAP(FX_BOOL bNeedAP);
635 600
636 int CountFieldsInCalculationOrder(); 601 int CountFieldsInCalculationOrder();
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 FX_FLOAT fc[4], 1165 FX_FLOAT fc[4],
1201 const CFX_ByteStringC& csEntry); 1166 const CFX_ByteStringC& csEntry);
1202 1167
1203 CFX_WideString GetCaption(const CFX_ByteStringC& csEntry); 1168 CFX_WideString GetCaption(const CFX_ByteStringC& csEntry);
1204 1169
1205 CPDF_Stream* GetIcon(const CFX_ByteStringC& csEntry); 1170 CPDF_Stream* GetIcon(const CFX_ByteStringC& csEntry);
1206 friend class CPDF_FormControl; 1171 friend class CPDF_FormControl;
1207 }; 1172 };
1208 1173
1209 #endif // CORE_INCLUDE_FPDFDOC_FPDF_DOC_H_ 1174 #endif // CORE_INCLUDE_FPDFDOC_FPDF_DOC_H_
OLDNEW
« no previous file with comments | « no previous file | core/src/fpdfdoc/doc_annot.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698