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

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

Issue 2306663002: Add observer for BAAnnots from Javascript (Closed)
Patch Set: Review updates Created 4 years, 3 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 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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_CPDFSDK_ANNOT_H_ 7 #ifndef FPDFSDK_INCLUDE_CPDFSDK_ANNOT_H_
8 #define FPDFSDK_INCLUDE_CPDFSDK_ANNOT_H_ 8 #define FPDFSDK_INCLUDE_CPDFSDK_ANNOT_H_
9 9
10 #include "core/fpdfdoc/include/cpdf_aaction.h" 10 #include "core/fpdfdoc/include/cpdf_aaction.h"
11 #include "core/fpdfdoc/include/cpdf_annot.h" 11 #include "core/fpdfdoc/include/cpdf_annot.h"
12 #include "core/fpdfdoc/include/cpdf_defaultappearance.h" 12 #include "core/fpdfdoc/include/cpdf_defaultappearance.h"
13 #include "core/fxcrt/include/fx_basic.h" 13 #include "core/fxcrt/include/fx_basic.h"
14 #include "fpdfsdk/cfx_systemhandler.h" 14 #include "fpdfsdk/cfx_systemhandler.h"
15 #include "fpdfsdk/include/fsdk_common.h" 15 #include "fpdfsdk/include/fsdk_common.h"
16 #include "fpdfsdk/include/fsdk_define.h" 16 #include "fpdfsdk/include/fsdk_define.h"
17 17
18 class CFX_Matrix; 18 class CFX_Matrix;
19 class CFX_RenderDevice; 19 class CFX_RenderDevice;
20 class CPDF_Page; 20 class CPDF_Page;
21 class CPDF_RenderOptions; 21 class CPDF_RenderOptions;
22 class CPDFSDK_PageView; 22 class CPDFSDK_PageView;
23 23
24 class CPDFSDK_Annot { 24 class CPDFSDK_Annot {
25 public: 25 public:
26 class Observer {
27 public:
28 explicit Observer(CPDFSDK_Annot** pWatchedPtr);
29 ~Observer();
30 void OnAnnotDestroyed();
31
32 private:
33 CPDFSDK_Annot** m_pWatchedPtr;
34 };
35
26 explicit CPDFSDK_Annot(CPDFSDK_PageView* pPageView); 36 explicit CPDFSDK_Annot(CPDFSDK_PageView* pPageView);
27 virtual ~CPDFSDK_Annot(); 37 virtual ~CPDFSDK_Annot();
28 38
39 void AddObserver(Observer* observer);
40 void RemoveObserver(Observer* observer);
41
29 #ifdef PDF_ENABLE_XFA 42 #ifdef PDF_ENABLE_XFA
30 virtual FX_BOOL IsXFAField(); 43 virtual FX_BOOL IsXFAField();
31 virtual CXFA_FFWidget* GetXFAWidget() const; 44 virtual CXFA_FFWidget* GetXFAWidget() const;
32 #endif // PDF_ENABLE_XFA 45 #endif // PDF_ENABLE_XFA
33 46
34 virtual FX_FLOAT GetMinWidth() const; 47 virtual FX_FLOAT GetMinWidth() const;
35 virtual FX_FLOAT GetMinHeight() const; 48 virtual FX_FLOAT GetMinHeight() const;
36 virtual int GetLayoutOrder() const; 49 virtual int GetLayoutOrder() const;
37 virtual CPDF_Annot* GetPDFAnnot() const; 50 virtual CPDF_Annot* GetPDFAnnot() const;
38 virtual CPDF_Annot::Subtype GetAnnotSubtype() const; 51 virtual CPDF_Annot::Subtype GetAnnotSubtype() const;
(...skipping 11 matching lines...) Expand all
50 CPDFXFA_Page* GetPDFXFAPage(); 63 CPDFXFA_Page* GetPDFXFAPage();
51 #endif // PDF_ENABLE_XFA 64 #endif // PDF_ENABLE_XFA
52 65
53 void SetPage(CPDFSDK_PageView* pPageView); 66 void SetPage(CPDFSDK_PageView* pPageView);
54 CPDFSDK_PageView* GetPageView() const { return m_pPageView; } 67 CPDFSDK_PageView* GetPageView() const { return m_pPageView; }
55 68
56 FX_BOOL IsSelected(); 69 FX_BOOL IsSelected();
57 void SetSelected(FX_BOOL bSelected); 70 void SetSelected(FX_BOOL bSelected);
58 71
59 protected: 72 protected:
73 std::set<Observer*> m_Observers;
60 CPDFSDK_PageView* m_pPageView; 74 CPDFSDK_PageView* m_pPageView;
61 FX_BOOL m_bSelected; 75 FX_BOOL m_bSelected;
62 }; 76 };
63 77
64 #endif // FPDFSDK_INCLUDE_CPDFSDK_ANNOT_H_ 78 #endif // FPDFSDK_INCLUDE_CPDFSDK_ANNOT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698