diff options
author | Tom Sepez <tsepez@chromium.org> | 2016-02-01 13:37:38 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2016-02-01 13:37:38 -0800 |
commit | 0841b0f37678ba4962247f5636e9390718fc027e (patch) | |
tree | 4ff926df6ffa86e3d8f8b7b34a0c40f9daeb196d /fpdfsdk/include/fsdk_baseform.h | |
parent | 93c196d868535f684007a7d3ed1f7146851a0ab9 (diff) | |
download | pdfium-0841b0f37678ba4962247f5636e9390718fc027e.tar.xz |
Remove CGW_ArrayTemplate and its O(n^2 log n) sort.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1652613002 .
Diffstat (limited to 'fpdfsdk/include/fsdk_baseform.h')
-rw-r--r-- | fpdfsdk/include/fsdk_baseform.h | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/fpdfsdk/include/fsdk_baseform.h b/fpdfsdk/include/fsdk_baseform.h index f553bd8848..0290ef021d 100644 --- a/fpdfsdk/include/fsdk_baseform.h +++ b/fpdfsdk/include/fsdk_baseform.h @@ -14,12 +14,13 @@ #endif #include <map> +#include <vector> #include "core/include/fpdfapi/fpdf_parser.h" #include "core/include/fpdfdoc/fpdf_doc.h" #include "core/include/fxcrt/fx_basic.h" #include "core/include/fxge/fx_dib.h" -#include "fsdk_baseannot.h" +#include "fpdfsdk/include/fsdk_baseannot.h" class CFFL_FormFiller; class CPDFSDK_Annot; @@ -273,14 +274,10 @@ class CPDFSDK_InterForm : public CPDF_FormNotify { FX_BOOL m_bNeedHightlight[kNumFieldTypes]; }; -#define BAI_STRUCTURE 0 -#define BAI_ROW 1 -#define BAI_COLUMN 2 - -#define CPDFSDK_Annots CFX_ArrayTemplate<CPDFSDK_Annot*> -#define CPDFSDK_SortAnnots CGW_ArrayTemplate<CPDFSDK_Annot*> class CBA_AnnotIterator { public: + enum TabOrder { STRUCTURE = 0, ROW, COLUMN }; + CBA_AnnotIterator(CPDFSDK_PageView* pPageView, const CFX_ByteString& sType, const CFX_ByteString& sSubType); @@ -293,15 +290,19 @@ class CBA_AnnotIterator { private: void GenerateResults(); - static int CompareByLeft(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2); - static int CompareByTop(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2); - static CPDF_Rect GetAnnotRect(CPDFSDK_Annot* pAnnot); + static CPDF_Rect GetAnnotRect(const CPDFSDK_Annot* pAnnot); + + // Function signature compatible with std::sort(). + static bool CompareByLeftAscending(const CPDFSDK_Annot* p1, + const CPDFSDK_Annot* p2); + static bool CompareByTopDescending(const CPDFSDK_Annot* p1, + const CPDFSDK_Annot* p2); + TabOrder m_eTabOrder; CPDFSDK_PageView* m_pPageView; CFX_ByteString m_sType; CFX_ByteString m_sSubType; - int m_nTabs; - CPDFSDK_Annots m_Annots; + std::vector<CPDFSDK_Annot*> m_Annots; }; #endif // FPDFSDK_INCLUDE_FSDK_BASEFORM_H_ |