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

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

Issue 1411203007: Cleanup parts of CPDFSDK_AnnotIterator and CPDFSDK_PageView. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: 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
« 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_ANNOTHANDLER_H_ 7 #ifndef FPDFSDK_INCLUDE_FSDK_ANNOTHANDLER_H_
8 #define FPDFSDK_INCLUDE_FSDK_ANNOTHANDLER_H_ 8 #define FPDFSDK_INCLUDE_FSDK_ANNOTHANDLER_H_
9 9
10 #include <map> 10 #include <map>
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 virtual void OnDeSelected(CPDFSDK_Annot* pAnnot) = 0; 116 virtual void OnDeSelected(CPDFSDK_Annot* pAnnot) = 0;
117 virtual void OnSelected(CPDFSDK_Annot* pAnnot) = 0; 117 virtual void OnSelected(CPDFSDK_Annot* pAnnot) = 0;
118 118
119 virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0; 119 virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0;
120 virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0; 120 virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0;
121 }; 121 };
122 122
123 class CPDFSDK_BFAnnotHandler : public IPDFSDK_AnnotHandler { 123 class CPDFSDK_BFAnnotHandler : public IPDFSDK_AnnotHandler {
124 public: 124 public:
125 CPDFSDK_BFAnnotHandler(CPDFDoc_Environment* pApp) 125 explicit CPDFSDK_BFAnnotHandler(CPDFDoc_Environment* pApp)
126 : m_pApp(pApp), m_pFormFiller(NULL) {} 126 : m_pApp(pApp), m_pFormFiller(NULL) {}
127 ~CPDFSDK_BFAnnotHandler() override {} 127 ~CPDFSDK_BFAnnotHandler() override {}
128 128
129 // IPDFSDK_AnnotHandler 129 // IPDFSDK_AnnotHandler
130 CFX_ByteString GetType() override { return CFX_ByteString("Widget"); } 130 CFX_ByteString GetType() override { return CFX_ByteString("Widget"); }
131 CFX_ByteString GetName() override { return CFX_ByteString("WidgetHandler"); } 131 CFX_ByteString GetName() override { return CFX_ByteString("WidgetHandler"); }
132 FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) override; 132 FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) override;
133 CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) override; 133 CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) override;
134 void ReleaseAnnot(CPDFSDK_Annot* pAnnot) override; 134 void ReleaseAnnot(CPDFSDK_Annot* pAnnot) override;
135 void DeleteAnnot(CPDFSDK_Annot* pAnnot) override {} 135 void DeleteAnnot(CPDFSDK_Annot* pAnnot) override {}
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 private: 296 private:
297 IPDFSDK_AnnotHandler* GetAnnotHandler(const CFX_ByteString& sType) const; 297 IPDFSDK_AnnotHandler* GetAnnotHandler(const CFX_ByteString& sType) const;
298 CPDFSDK_Annot* GetNextAnnot(CPDFSDK_Annot* pSDKAnnot, FX_BOOL bNext); 298 CPDFSDK_Annot* GetNextAnnot(CPDFSDK_Annot* pSDKAnnot, FX_BOOL bNext);
299 299
300 private: 300 private:
301 CBA_AnnotHandlerArray m_Handlers; 301 CBA_AnnotHandlerArray m_Handlers;
302 std::map<CFX_ByteString, IPDFSDK_AnnotHandler*> m_mapType2Handler; 302 std::map<CFX_ByteString, IPDFSDK_AnnotHandler*> m_mapType2Handler;
303 CPDFDoc_Environment* m_pApp; 303 CPDFDoc_Environment* m_pApp;
304 }; 304 };
305 305
306 typedef int (*AI_COMPARE)(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2);
307
308 class CPDFSDK_AnnotIterator { 306 class CPDFSDK_AnnotIterator {
309 public: 307 public:
310 CPDFSDK_AnnotIterator(CPDFSDK_PageView* pPageView, 308 CPDFSDK_AnnotIterator(CPDFSDK_PageView* pPageView, bool bReverse);
311 FX_BOOL bReverse, 309 ~CPDFSDK_AnnotIterator();
312 FX_BOOL bIgnoreTopmost = FALSE,
Lei Zhang 2015/10/21 14:24:16 Never explicitly set, thus there's dead code in th
313 FX_BOOL bCircle = FALSE,
314 CFX_PtrArray* pList = NULL);
315 virtual ~CPDFSDK_AnnotIterator() {}
316 310
317 virtual CPDFSDK_Annot* Next(const CPDFSDK_Annot* pCurrent); 311 CPDFSDK_Annot* Next(int* index);
318 virtual CPDFSDK_Annot* Prev(const CPDFSDK_Annot* pCurrent); 312 CPDFSDK_Annot* Prev(int* index);
Lei Zhang 2015/10/21 14:24:16 Also dead, but leaving it in for completeness.
319 virtual CPDFSDK_Annot* Next(int& index); 313 int Count() const { return m_pIteratorAnnotList.GetSize(); }
320 virtual CPDFSDK_Annot* Prev(int& index);
321 virtual int Count() { return m_pIteratorAnnotList.GetSize(); }
322
323 virtual FX_BOOL InitIteratorAnnotList(CPDFSDK_PageView* pPageView,
324 CFX_PtrArray* pList = NULL);
325
326 void InsertSort(CFX_PtrArray& arrayList, AI_COMPARE pCompare);
327 314
328 protected: 315 protected:
329 CPDFSDK_Annot* NextAnnot(const CPDFSDK_Annot* pCurrent); 316 CPDFSDK_Annot* NextAnnot(int* index);
330 CPDFSDK_Annot* PrevAnnot(const CPDFSDK_Annot* pCurrent); 317 CPDFSDK_Annot* PrevAnnot(int* index);
331 CPDFSDK_Annot* NextAnnot(int& index); 318 void InsertSort();
332 CPDFSDK_Annot* PrevAnnot(int& index);
333 319
334 CFX_PtrArray m_pIteratorAnnotList; 320 CFX_PtrArray m_pIteratorAnnotList;
335 FX_BOOL m_bReverse; 321 const bool m_bReverse;
336 FX_BOOL m_bIgnoreTopmost;
337 FX_BOOL m_bCircle;
338 }; 322 };
339 323
340 #endif // FPDFSDK_INCLUDE_FSDK_ANNOTHANDLER_H_ 324 #endif // FPDFSDK_INCLUDE_FSDK_ANNOTHANDLER_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