diff options
author | dsinclair <dsinclair@chromium.org> | 2016-10-05 12:00:34 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-05 12:00:34 -0700 |
commit | 8afe15a019c78a24168ebc42306342c25358ccdf (patch) | |
tree | 09012697e63b0a1fa4654f6e6f93b69a04421171 /fpdfsdk/cpdfsdk_pageview.h | |
parent | 7c1b07fde27dfbbf1d979d9dfd616b1a42591e5f (diff) | |
download | pdfium-8afe15a019c78a24168ebc42306342c25358ccdf.tar.xz |
Cleanup some CPDFSDK_PageView annotation code.
This Cl cleans up the code regarding CPDFSDK_Annots in CPDFSDK_PageView.
This includes:
* Makes DeleteAnnot XFA only and wraps at the call site.
* Removes unused methods
* Replaces use of CountAnnots and GetAnnot with vector iteration
* Removes {Set|Kill}FocusAnnot from CPDFSDK_PageView
* Renames m_fxAnnotArray to m_SDKAnnotArray
Review-Url: https://codereview.chromium.org/2384323005
Diffstat (limited to 'fpdfsdk/cpdfsdk_pageview.h')
-rw-r--r-- | fpdfsdk/cpdfsdk_pageview.h | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/fpdfsdk/cpdfsdk_pageview.h b/fpdfsdk/cpdfsdk_pageview.h index f29af7055a..cd9ddec6bd 100644 --- a/fpdfsdk/cpdfsdk_pageview.h +++ b/fpdfsdk/cpdfsdk_pageview.h @@ -35,32 +35,24 @@ class CPDFSDK_PageView final : public CPDF_Page::View { CPDF_RenderOptions* pOptions); #endif // PDF_ENABLE_XFA - const CPDF_Annot* GetPDFAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); CPDFSDK_Annot* GetFXAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); - const CPDF_Annot* GetPDFWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); CPDFSDK_Annot* GetFXWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); - CPDFSDK_Annot* GetFocusAnnot(); - void SetFocusAnnot(CPDFSDK_Annot::ObservedPtr* pSDKAnnot, - uint32_t nFlag = 0) { - m_pSDKDoc->SetFocusAnnot(pSDKAnnot, nFlag); - } - FX_BOOL KillFocusAnnot(uint32_t nFlag = 0) { - return m_pSDKDoc->KillFocusAnnot(nFlag); - } - void KillFocusAnnotIfNeeded(); - CPDFSDK_Annot* AddAnnot(CPDF_Dictionary* pDict); - CPDFSDK_Annot* AddAnnot(const FX_CHAR* lpSubType, CPDF_Dictionary* pDict); - CPDFSDK_Annot* AddAnnot(CPDF_Annot* pPDFAnnot); + void LoadFXAnnots(); + CPDFSDK_Annot* GetFocusAnnot(); + bool IsValidAnnot(const CPDF_Annot* p) const; + bool IsValidSDKAnnot(const CPDFSDK_Annot* p) const; - FX_BOOL DeleteAnnot(CPDFSDK_Annot* pAnnot); - size_t CountAnnots() const; - CPDFSDK_Annot* GetAnnot(size_t nIndex); + const std::vector<CPDFSDK_Annot*>& GetAnnotList() const { + return m_SDKAnnotArray; + } CPDFSDK_Annot* GetAnnotByDict(CPDF_Dictionary* pDict); #ifdef PDF_ENABLE_XFA + FX_BOOL DeleteAnnot(CPDFSDK_Annot* pAnnot); CPDFSDK_Annot* AddAnnot(CXFA_FFWidget* pPDFAnnot); CPDFSDK_Annot* GetAnnotByXFAWidget(CXFA_FFWidget* hWidget); + CPDFXFA_Page* GetPDFXFAPage() { return m_page; } #endif // PDF_ENABLE_XFA @@ -82,16 +74,12 @@ class CPDFSDK_PageView final : public CPDF_Page::View { double deltaY, const CFX_FloatPoint& point, int nFlag); - bool IsValidAnnot(const CPDF_Annot* p) const; + void GetCurrentMatrix(CFX_Matrix& matrix) { matrix = m_curMatrix; } void UpdateRects(const std::vector<CFX_FloatRect>& rects); void UpdateView(CPDFSDK_Annot* pAnnot); - const std::vector<CPDFSDK_Annot*>& GetAnnotList() const { - return m_fxAnnotArray; - } int GetPageIndex() const; - void LoadFXAnnots(); void SetValid(FX_BOOL bValid) { m_bValid = bValid; } FX_BOOL IsValid() { return m_bValid; } @@ -113,7 +101,7 @@ class CPDFSDK_PageView final : public CPDF_Page::View { CFX_Matrix m_curMatrix; UnderlyingPageType* const m_page; std::unique_ptr<CPDF_AnnotList> m_pAnnotList; - std::vector<CPDFSDK_Annot*> m_fxAnnotArray; + std::vector<CPDFSDK_Annot*> m_SDKAnnotArray; CPDFSDK_Document* const m_pSDKDoc; CPDFSDK_Annot::ObservedPtr m_pCaptureWidget; #ifndef PDF_ENABLE_XFA |