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

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

Issue 1411203007: Cleanup parts of CPDFSDK_AnnotIterator and CPDFSDK_PageView. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: fix bounds check Created 5 years, 2 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
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_MGR_H_ 7 #ifndef FPDFSDK_INCLUDE_FSDK_MGR_H_
8 #define FPDFSDK_INCLUDE_FSDK_MGR_H_ 8 #define FPDFSDK_INCLUDE_FSDK_MGR_H_
9 9
10 #include <map> 10 #include <map>
11 11
12 #include "../../core/include/fpdftext/fpdf_text.h" 12 #include "../../core/include/fpdftext/fpdf_text.h"
13 #include "../../public/fpdf_formfill.h" 13 #include "../../public/fpdf_formfill.h"
14 #include "../../public/fpdf_fwlevent.h" // cross platform keycode and events de fine. 14 #include "../../public/fpdf_fwlevent.h" // cross platform keycode and events de fine.
15 #include "../../third_party/base/nonstd_unique_ptr.h"
15 #include "fsdk_common.h" 16 #include "fsdk_common.h"
16 #include "fsdk_define.h" 17 #include "fsdk_define.h"
17 #include "fx_systemhandler.h" 18 #include "fx_systemhandler.h"
18 #include "fsdk_baseannot.h" 19 #include "fsdk_baseannot.h"
19 #include "fsdk_baseform.h" 20 #include "fsdk_baseform.h"
20 #include "fsdk_annothandler.h" 21 #include "fsdk_annothandler.h"
21 #include "fsdk_actionhandler.h" 22 #include "fsdk_actionhandler.h"
22 #include "javascript/IJavaScript.h" 23 #include "javascript/IJavaScript.h"
23 24
24 class CFFL_IFormFiller; 25 class CFFL_IFormFiller;
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 } 294 }
294 FX_BOOL KillFocusAnnot(FX_UINT nFlag = 0) { 295 FX_BOOL KillFocusAnnot(FX_UINT nFlag = 0) {
295 return m_pSDKDoc->KillFocusAnnot(nFlag); 296 return m_pSDKDoc->KillFocusAnnot(nFlag);
296 } 297 }
297 FX_BOOL Annot_HasAppearance(CPDF_Annot* pAnnot); 298 FX_BOOL Annot_HasAppearance(CPDF_Annot* pAnnot);
298 299
299 CPDFSDK_Annot* AddAnnot(CPDF_Dictionary* pDict); 300 CPDFSDK_Annot* AddAnnot(CPDF_Dictionary* pDict);
300 CPDFSDK_Annot* AddAnnot(const FX_CHAR* lpSubType, CPDF_Dictionary* pDict); 301 CPDFSDK_Annot* AddAnnot(const FX_CHAR* lpSubType, CPDF_Dictionary* pDict);
301 CPDFSDK_Annot* AddAnnot(CPDF_Annot* pPDFAnnot); 302 CPDFSDK_Annot* AddAnnot(CPDF_Annot* pPDFAnnot);
302 FX_BOOL DeleteAnnot(CPDFSDK_Annot* pAnnot); 303 FX_BOOL DeleteAnnot(CPDFSDK_Annot* pAnnot);
303 int CountAnnots(); 304 int CountAnnots() const;
304 CPDFSDK_Annot* GetAnnot(int nIndex); 305 CPDFSDK_Annot* GetAnnot(size_t nIndex);
305 CPDFSDK_Annot* GetAnnotByDict(CPDF_Dictionary* pDict); 306 CPDFSDK_Annot* GetAnnotByDict(CPDF_Dictionary* pDict);
306 CPDF_Page* GetPDFPage() { return m_page; } 307 CPDF_Page* GetPDFPage() { return m_page; }
307 CPDF_Document* GetPDFDocument(); 308 CPDF_Document* GetPDFDocument();
308 CPDFSDK_Document* GetSDKDocument() { return m_pSDKDoc; } 309 CPDFSDK_Document* GetSDKDocument() { return m_pSDKDoc; }
309 FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_UINT nFlag); 310 FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_UINT nFlag);
310 FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_UINT nFlag); 311 FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_UINT nFlag);
311 FX_BOOL OnChar(int nChar, FX_UINT nFlag); 312 FX_BOOL OnChar(int nChar, FX_UINT nFlag);
312 FX_BOOL OnKeyDown(int nKeyCode, int nFlag); 313 FX_BOOL OnKeyDown(int nKeyCode, int nFlag);
313 FX_BOOL OnKeyUp(int nKeyCode, int nFlag); 314 FX_BOOL OnKeyUp(int nKeyCode, int nFlag);
314 315
315 FX_BOOL OnMouseMove(const CPDF_Point& point, int nFlag); 316 FX_BOOL OnMouseMove(const CPDF_Point& point, int nFlag);
316 FX_BOOL OnMouseWheel(double deltaX, 317 FX_BOOL OnMouseWheel(double deltaX,
317 double deltaY, 318 double deltaY,
318 const CPDF_Point& point, 319 const CPDF_Point& point,
319 int nFlag); 320 int nFlag);
320 FX_BOOL IsValidAnnot(void* p); 321 FX_BOOL IsValidAnnot(void* p) const;
321 void GetCurrentMatrix(CPDF_Matrix& matrix) { matrix = m_curMatrix; } 322 void GetCurrentMatrix(CPDF_Matrix& matrix) { matrix = m_curMatrix; }
322 void UpdateRects(CFX_RectArray& rects); 323 void UpdateRects(CFX_RectArray& rects);
323 void UpdateView(CPDFSDK_Annot* pAnnot); 324 void UpdateView(CPDFSDK_Annot* pAnnot);
324 CFX_PtrArray* GetAnnotList() { return &m_fxAnnotArray; } 325 const std::vector<CPDFSDK_Annot*>& GetAnnotList() const {
326 return m_fxAnnotArray;
327 }
325 328
326 int GetPageIndex(); 329 int GetPageIndex();
327 void LoadFXAnnots(); 330 void LoadFXAnnots();
328 void SetValid(FX_BOOL bValid) { m_bValid = bValid; } 331 void SetValid(FX_BOOL bValid) { m_bValid = bValid; }
329 FX_BOOL IsValid() { return m_bValid; } 332 FX_BOOL IsValid() { return m_bValid; }
330 void SetLock(FX_BOOL bLocked) { m_bLocked = bLocked; } 333 void SetLock(FX_BOOL bLocked) { m_bLocked = bLocked; }
331 FX_BOOL IsLocked() { return m_bLocked; } 334 FX_BOOL IsLocked() { return m_bLocked; }
332 void TakeOverPage() { m_bTakeOverPage = TRUE; } 335 void TakeOverPage() { m_bTakeOverPage = TRUE; }
333 336
334 private: 337 private:
335 void PageView_OnHighlightFormFields(CFX_RenderDevice* pDevice, 338 void PageView_OnHighlightFormFields(CFX_RenderDevice* pDevice,
336 CPDFSDK_Widget* pWidget); 339 CPDFSDK_Widget* pWidget);
340
337 CPDF_Matrix m_curMatrix; 341 CPDF_Matrix m_curMatrix;
338 CPDF_Page* m_page; 342 CPDF_Page* m_page;
339 CPDF_AnnotList* m_pAnnotList; 343 nonstd::unique_ptr<CPDF_AnnotList> m_pAnnotList;
340 // CPDFSDK_Annot* m_pFocusAnnot; 344 std::vector<CPDFSDK_Annot*> m_fxAnnotArray;
341 CFX_PtrArray m_fxAnnotArray;
342 CPDFSDK_Document* m_pSDKDoc; 345 CPDFSDK_Document* m_pSDKDoc;
343 CPDFSDK_Widget* m_CaptureWidget; 346 CPDFSDK_Widget* m_CaptureWidget;
344 FX_BOOL m_bEnterWidget; 347 FX_BOOL m_bEnterWidget;
345 FX_BOOL m_bExitWidget; 348 FX_BOOL m_bExitWidget;
346 FX_BOOL m_bOnWidget; 349 FX_BOOL m_bOnWidget;
347 FX_BOOL m_bValid; 350 FX_BOOL m_bValid;
348 FX_BOOL m_bLocked; 351 FX_BOOL m_bLocked;
349 FX_BOOL m_bTakeOverPage; 352 FX_BOOL m_bTakeOverPage;
350 }; 353 };
351 354
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 } 419 }
417 420
418 if (nStartPos < m) 421 if (nStartPos < m)
419 QuickSort(nStartPos, m, bAscend, pCompare); 422 QuickSort(nStartPos, m, bAscend, pCompare);
420 if (nStopPos > m) 423 if (nStopPos > m)
421 QuickSort(m, nStopPos, bAscend, pCompare); 424 QuickSort(m, nStopPos, bAscend, pCompare);
422 } 425 }
423 }; 426 };
424 427
425 #endif // FPDFSDK_INCLUDE_FSDK_MGR_H_ 428 #endif // FPDFSDK_INCLUDE_FSDK_MGR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698