summaryrefslogtreecommitdiff
path: root/fpdfsdk/include
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/include')
-rw-r--r--fpdfsdk/include/fsdk_annothandler.h47
-rw-r--r--fpdfsdk/include/fsdk_mgr.h17
2 files changed, 25 insertions, 39 deletions
diff --git a/fpdfsdk/include/fsdk_annothandler.h b/fpdfsdk/include/fsdk_annothandler.h
index c15681de96..6ce9e1229a 100644
--- a/fpdfsdk/include/fsdk_annothandler.h
+++ b/fpdfsdk/include/fsdk_annothandler.h
@@ -8,6 +8,7 @@
#define FPDFSDK_INCLUDE_FSDK_ANNOTHANDLER_H_
#include <map>
+#include <vector>
#include "../../core/include/fxcrt/fx_basic.h"
@@ -129,7 +130,7 @@ class IPDFSDK_AnnotHandler {
class CPDFSDK_BFAnnotHandler : public IPDFSDK_AnnotHandler {
public:
- CPDFSDK_BFAnnotHandler(CPDFDoc_Environment* pApp)
+ explicit CPDFSDK_BFAnnotHandler(CPDFDoc_Environment* pApp)
: m_pApp(pApp), m_pFormFiller(NULL) {}
~CPDFSDK_BFAnnotHandler() override {}
@@ -227,7 +228,7 @@ class CPDFSDK_BFAnnotHandler : public IPDFSDK_AnnotHandler {
class CPDFSDK_XFAAnnotHandler : public IPDFSDK_AnnotHandler {
public:
- CPDFSDK_XFAAnnotHandler(CPDFDoc_Environment* pApp);
+ explicit CPDFSDK_XFAAnnotHandler(CPDFDoc_Environment* pApp);
~CPDFSDK_XFAAnnotHandler() {}
public:
@@ -433,38 +434,20 @@ class CPDFSDK_AnnotHandlerMgr {
CPDFDoc_Environment* m_pApp;
};
-typedef int (*AI_COMPARE)(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2);
-
class CPDFSDK_AnnotIterator {
public:
- CPDFSDK_AnnotIterator(CPDFSDK_PageView* pPageView,
- FX_BOOL bReverse,
- FX_BOOL bIgnoreTopmost = FALSE,
- FX_BOOL bCircle = FALSE,
- CFX_PtrArray* pList = NULL);
- virtual ~CPDFSDK_AnnotIterator() {}
-
- virtual CPDFSDK_Annot* Next(const CPDFSDK_Annot* pCurrent);
- virtual CPDFSDK_Annot* Prev(const CPDFSDK_Annot* pCurrent);
- virtual CPDFSDK_Annot* Next(int& index);
- virtual CPDFSDK_Annot* Prev(int& index);
- virtual int Count() { return m_pIteratorAnnotList.GetSize(); }
-
- virtual FX_BOOL InitIteratorAnnotList(CPDFSDK_PageView* pPageView,
- CFX_PtrArray* pList = NULL);
-
- void InsertSort(CFX_PtrArray& arrayList, AI_COMPARE pCompare);
-
- protected:
- CPDFSDK_Annot* NextAnnot(const CPDFSDK_Annot* pCurrent);
- CPDFSDK_Annot* PrevAnnot(const CPDFSDK_Annot* pCurrent);
- CPDFSDK_Annot* NextAnnot(int& index);
- CPDFSDK_Annot* PrevAnnot(int& index);
-
- CFX_PtrArray m_pIteratorAnnotList;
- FX_BOOL m_bReverse;
- FX_BOOL m_bIgnoreTopmost;
- FX_BOOL m_bCircle;
+ CPDFSDK_AnnotIterator(CPDFSDK_PageView* pPageView, bool bReverse);
+ ~CPDFSDK_AnnotIterator();
+
+ CPDFSDK_Annot* Next();
+
+ private:
+ CPDFSDK_Annot* NextAnnot();
+ CPDFSDK_Annot* PrevAnnot();
+
+ std::vector<CPDFSDK_Annot*> m_iteratorAnnotList;
+ const bool m_bReverse;
+ size_t m_pos;
};
#endif // FPDFSDK_INCLUDE_FSDK_ANNOTHANDLER_H_
diff --git a/fpdfsdk/include/fsdk_mgr.h b/fpdfsdk/include/fsdk_mgr.h
index 300ca2287e..d19c9233d7 100644
--- a/fpdfsdk/include/fsdk_mgr.h
+++ b/fpdfsdk/include/fsdk_mgr.h
@@ -12,6 +12,7 @@
#include "../../core/include/fpdftext/fpdf_text.h"
#include "../../public/fpdf_formfill.h"
#include "../../public/fpdf_fwlevent.h" // cross platform keycode and events define.
+#include "../../third_party/base/nonstd_unique_ptr.h"
#include "fsdk_common.h"
#include "fsdk_define.h"
#include "fx_systemhandler.h"
@@ -554,8 +555,8 @@ class CPDFSDK_PageView final {
CPDFSDK_Annot* AddAnnot(CPDF_Annot* pPDFAnnot);
CPDFSDK_Annot* AddAnnot(IXFA_Widget* pPDFAnnot);
FX_BOOL DeleteAnnot(CPDFSDK_Annot* pAnnot);
- int CountAnnots();
- CPDFSDK_Annot* GetAnnot(int nIndex);
+ int CountAnnots() const;
+ CPDFSDK_Annot* GetAnnot(size_t nIndex);
CPDFSDK_Annot* GetAnnotByDict(CPDF_Dictionary* pDict);
CPDFSDK_Annot* GetAnnotByXFAWidget(IXFA_Widget* hWidget);
CPDFXFA_Page* GetPDFXFAPage() { return m_page; }
@@ -575,11 +576,13 @@ class CPDFSDK_PageView final {
double deltaY,
const CPDF_Point& point,
int nFlag);
- FX_BOOL IsValidAnnot(void* p);
+ FX_BOOL IsValidAnnot(CPDF_Annot* p) const;
void GetCurrentMatrix(CPDF_Matrix& matrix) { matrix = m_curMatrix; }
void UpdateRects(CFX_RectArray& rects);
void UpdateView(CPDFSDK_Annot* pAnnot);
- CFX_PtrArray* GetAnnotList() { return &m_fxAnnotArray; }
+ const std::vector<CPDFSDK_Annot*>& GetAnnotList() const {
+ return m_fxAnnotArray;
+ }
int GetPageIndex();
void LoadFXAnnots();
@@ -591,11 +594,11 @@ class CPDFSDK_PageView final {
private:
void PageView_OnHighlightFormFields(CFX_RenderDevice* pDevice,
CPDFSDK_Widget* pWidget);
+
CPDF_Matrix m_curMatrix;
CPDFXFA_Page* m_page;
- CPDF_AnnotList* m_pAnnotList;
- // CPDFSDK_Annot* m_pFocusAnnot;
- CFX_PtrArray m_fxAnnotArray;
+ nonstd::unique_ptr<CPDF_AnnotList> m_pAnnotList;
+ std::vector<CPDFSDK_Annot*> m_fxAnnotArray;
CPDFSDK_Document* m_pSDKDoc;
CPDFSDK_Annot* m_CaptureWidget;
FX_BOOL m_bEnterWidget;