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

Side by Side Diff: fpdfsdk/include/fsdk_baseform.h

Issue 1652613002: Remove CGW_ArrayTemplate and its O(n^2 log n) sort. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Another pointless empty() check. Created 4 years, 10 months 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 | fpdfsdk/include/fsdk_mgr.h » ('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 FPDFSDK_INCLUDE_FSDK_BASEFORM_H_ 7 #ifndef FPDFSDK_INCLUDE_FSDK_BASEFORM_H_
8 #define FPDFSDK_INCLUDE_FSDK_BASEFORM_H_ 8 #define FPDFSDK_INCLUDE_FSDK_BASEFORM_H_
9 9
10 #if _FX_OS_ == _FX_ANDROID_ 10 #if _FX_OS_ == _FX_ANDROID_
11 #include "time.h" 11 #include "time.h"
12 #else 12 #else
13 #include <ctime> 13 #include <ctime>
14 #endif 14 #endif
15 15
16 #include <map> 16 #include <map>
17 #include <vector>
17 18
18 #include "core/include/fpdfapi/fpdf_parser.h" 19 #include "core/include/fpdfapi/fpdf_parser.h"
19 #include "core/include/fpdfdoc/fpdf_doc.h" 20 #include "core/include/fpdfdoc/fpdf_doc.h"
20 #include "core/include/fxcrt/fx_basic.h" 21 #include "core/include/fxcrt/fx_basic.h"
21 #include "core/include/fxge/fx_dib.h" 22 #include "core/include/fxge/fx_dib.h"
22 #include "fsdk_baseannot.h" 23 #include "fpdfsdk/include/fsdk_baseannot.h"
23 24
24 class CFFL_FormFiller; 25 class CFFL_FormFiller;
25 class CPDFSDK_Annot; 26 class CPDFSDK_Annot;
26 class CPDFSDK_DateTime; 27 class CPDFSDK_DateTime;
27 class CPDFSDK_Document; 28 class CPDFSDK_Document;
28 class CPDFSDK_InterForm; 29 class CPDFSDK_InterForm;
29 class CPDFSDK_PageView; 30 class CPDFSDK_PageView;
30 class CPDF_Action; 31 class CPDF_Action;
31 class CPDF_FormField; 32 class CPDF_FormField;
32 struct CPWL_Color; 33 struct CPWL_Color;
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 void SetHighlightColor(FX_COLORREF clr, int nFieldType); 267 void SetHighlightColor(FX_COLORREF clr, int nFieldType);
267 FX_COLORREF GetHighlightColor(int nFieldType); 268 FX_COLORREF GetHighlightColor(int nFieldType);
268 269
269 private: 270 private:
270 static const int kNumFieldTypes = 6; 271 static const int kNumFieldTypes = 6;
271 FX_COLORREF m_aHighlightColor[kNumFieldTypes]; 272 FX_COLORREF m_aHighlightColor[kNumFieldTypes];
272 uint8_t m_iHighlightAlpha; 273 uint8_t m_iHighlightAlpha;
273 FX_BOOL m_bNeedHightlight[kNumFieldTypes]; 274 FX_BOOL m_bNeedHightlight[kNumFieldTypes];
274 }; 275 };
275 276
276 #define BAI_STRUCTURE 0
277 #define BAI_ROW 1
278 #define BAI_COLUMN 2
279
280 #define CPDFSDK_Annots CFX_ArrayTemplate<CPDFSDK_Annot*>
281 #define CPDFSDK_SortAnnots CGW_ArrayTemplate<CPDFSDK_Annot*>
282 class CBA_AnnotIterator { 277 class CBA_AnnotIterator {
283 public: 278 public:
279 enum TabOrder { STRUCTURE = 0, ROW, COLUMN };
280
284 CBA_AnnotIterator(CPDFSDK_PageView* pPageView, 281 CBA_AnnotIterator(CPDFSDK_PageView* pPageView,
285 const CFX_ByteString& sType, 282 const CFX_ByteString& sType,
286 const CFX_ByteString& sSubType); 283 const CFX_ByteString& sSubType);
287 ~CBA_AnnotIterator(); 284 ~CBA_AnnotIterator();
288 285
289 CPDFSDK_Annot* GetFirstAnnot(); 286 CPDFSDK_Annot* GetFirstAnnot();
290 CPDFSDK_Annot* GetLastAnnot(); 287 CPDFSDK_Annot* GetLastAnnot();
291 CPDFSDK_Annot* GetNextAnnot(CPDFSDK_Annot* pAnnot); 288 CPDFSDK_Annot* GetNextAnnot(CPDFSDK_Annot* pAnnot);
292 CPDFSDK_Annot* GetPrevAnnot(CPDFSDK_Annot* pAnnot); 289 CPDFSDK_Annot* GetPrevAnnot(CPDFSDK_Annot* pAnnot);
293 290
294 private: 291 private:
295 void GenerateResults(); 292 void GenerateResults();
296 static int CompareByLeft(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2); 293 static CPDF_Rect GetAnnotRect(const CPDFSDK_Annot* pAnnot);
297 static int CompareByTop(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2);
298 static CPDF_Rect GetAnnotRect(CPDFSDK_Annot* pAnnot);
299 294
295 // Function signature compatible with std::sort().
296 static bool CompareByLeftAscending(const CPDFSDK_Annot* p1,
297 const CPDFSDK_Annot* p2);
298 static bool CompareByTopDescending(const CPDFSDK_Annot* p1,
299 const CPDFSDK_Annot* p2);
300
301 TabOrder m_eTabOrder;
300 CPDFSDK_PageView* m_pPageView; 302 CPDFSDK_PageView* m_pPageView;
301 CFX_ByteString m_sType; 303 CFX_ByteString m_sType;
302 CFX_ByteString m_sSubType; 304 CFX_ByteString m_sSubType;
303 int m_nTabs; 305 std::vector<CPDFSDK_Annot*> m_Annots;
304 CPDFSDK_Annots m_Annots;
305 }; 306 };
306 307
307 #endif // FPDFSDK_INCLUDE_FSDK_BASEFORM_H_ 308 #endif // FPDFSDK_INCLUDE_FSDK_BASEFORM_H_
OLDNEW
« no previous file with comments | « no previous file | fpdfsdk/include/fsdk_mgr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698