| OLD | NEW |
| 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_BASEANNOT_H_ | 7 #ifndef FPDFSDK_INCLUDE_FSDK_BASEANNOT_H_ |
| 8 #define FPDFSDK_INCLUDE_FSDK_BASEANNOT_H_ | 8 #define FPDFSDK_INCLUDE_FSDK_BASEANNOT_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 "../../core/include/fpdfdoc/fpdf_doc.h" | 16 #include "../../core/include/fpdfdoc/fpdf_doc.h" |
| 17 #include "../../core/include/fxcrt/fx_basic.h" | 17 #include "../../core/include/fxcrt/fx_basic.h" |
| 18 #include "fx_systemhandler.h" | 18 #include "fx_systemhandler.h" |
| 19 | 19 |
| 20 class CPDFSDK_PageView; | 20 class CPDFSDK_PageView; |
| 21 class CPDF_Annot; | 21 class CPDF_Annot; |
| 22 class CPDF_Page; | 22 class CPDF_Page; |
| 23 class CPDF_Rect; | 23 class CPDF_Rect; |
| 24 class CPDF_Matrix; | 24 class CPDF_Matrix; |
| 25 class CPDF_RenderOptions; | 25 class CPDF_RenderOptions; |
| 26 class CFX_RenderDevice; | 26 class CFX_RenderDevice; |
| 27 | 27 |
| 28 #define CFX_IntArray» » » » CFX_ArrayTemplate<int> | 28 #define CFX_IntArray CFX_ArrayTemplate<int> |
| 29 | 29 |
| 30 class CPDFSDK_DateTime | 30 class CPDFSDK_DateTime { |
| 31 { | 31 public: |
| 32 public: | 32 CPDFSDK_DateTime(); |
| 33 » CPDFSDK_DateTime(); | 33 CPDFSDK_DateTime(const CFX_ByteString& dtStr); |
| 34 » CPDFSDK_DateTime(const CFX_ByteString& dtStr); | 34 CPDFSDK_DateTime(const CPDFSDK_DateTime& datetime); |
| 35 » CPDFSDK_DateTime(const CPDFSDK_DateTime& datetime); | 35 CPDFSDK_DateTime(const FX_SYSTEMTIME& st); |
| 36 » CPDFSDK_DateTime(const FX_SYSTEMTIME& st); | |
| 37 | 36 |
| 37 CPDFSDK_DateTime& operator=(const CPDFSDK_DateTime& datetime); |
| 38 CPDFSDK_DateTime& operator=(const FX_SYSTEMTIME& st); |
| 39 FX_BOOL operator==(CPDFSDK_DateTime& datetime); |
| 40 FX_BOOL operator!=(CPDFSDK_DateTime& datetime); |
| 41 FX_BOOL operator>(CPDFSDK_DateTime& datetime); |
| 42 FX_BOOL operator>=(CPDFSDK_DateTime& datetime); |
| 43 FX_BOOL operator<(CPDFSDK_DateTime& datetime); |
| 44 FX_BOOL operator<=(CPDFSDK_DateTime& datetime); |
| 45 operator time_t(); |
| 38 | 46 |
| 39 » CPDFSDK_DateTime&» operator = (const CPDFSDK_DateTime& datetime); | 47 CPDFSDK_DateTime& FromPDFDateTimeString(const CFX_ByteString& dtStr); |
| 40 » CPDFSDK_DateTime&» operator = (const FX_SYSTEMTIME& st); | 48 CFX_ByteString ToCommonDateTimeString(); |
| 41 » FX_BOOL»» » » operator == (CPDFSDK_DateTime& datetime)
; | 49 CFX_ByteString ToPDFDateTimeString(); |
| 42 » FX_BOOL»» » » operator != (CPDFSDK_DateTime& datetime)
; | 50 void ToSystemTime(FX_SYSTEMTIME& st); |
| 43 » FX_BOOL»» » » operator > (CPDFSDK_DateTime& datetime); | 51 CPDFSDK_DateTime ToGMT(); |
| 44 » FX_BOOL»» » » operator >= (CPDFSDK_DateTime& datetime)
; | 52 CPDFSDK_DateTime& AddDays(short days); |
| 45 » FX_BOOL»» » » operator < (CPDFSDK_DateTime& datetime); | 53 CPDFSDK_DateTime& AddSeconds(int seconds); |
| 46 » FX_BOOL»» » » operator <= (CPDFSDK_DateTime& datetime)
; | |
| 47 » » » » » » operator time_t(); | |
| 48 | 54 |
| 49 » CPDFSDK_DateTime&» FromPDFDateTimeString(const CFX_ByteString& dtSt
r); | 55 void ResetDateTime(); |
| 50 » CFX_ByteString» » ToCommonDateTimeString(); | |
| 51 » CFX_ByteString» » ToPDFDateTimeString(); | |
| 52 » void» » » » ToSystemTime(FX_SYSTEMTIME& st); | |
| 53 » CPDFSDK_DateTime» ToGMT(); | |
| 54 » CPDFSDK_DateTime&» AddDays(short days); | |
| 55 » CPDFSDK_DateTime&» AddSeconds(int seconds); | |
| 56 | 56 |
| 57 » void» » » » ResetDateTime(); | 57 struct FX_DATETIME { |
| 58 | 58 int16_t year; |
| 59 » struct FX_DATETIME | 59 uint8_t month; |
| 60 » { | 60 uint8_t day; |
| 61 » » int16_t»year; | 61 uint8_t hour; |
| 62 » » uint8_t»» month; | 62 uint8_t minute; |
| 63 » » uint8_t»» day; | 63 uint8_t second; |
| 64 » » uint8_t»» hour; | 64 int8_t tzHour; |
| 65 » » uint8_t»» minute; | 65 uint8_t tzMinute; |
| 66 » » uint8_t»» second; | 66 } dt; |
| 67 » » int8_t »tzHour; | |
| 68 » » uint8_t»» tzMinute; | |
| 69 » }dt; | |
| 70 }; | 67 }; |
| 71 | 68 |
| 72 class CPDFSDK_Annot | 69 class CPDFSDK_Annot { |
| 73 { | 70 public: |
| 74 public: | 71 CPDFSDK_Annot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView); |
| 75 » CPDFSDK_Annot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView); | 72 virtual ~CPDFSDK_Annot(); |
| 76 » virtual ~CPDFSDK_Annot(); | |
| 77 public: | |
| 78 » virtual FX_FLOAT» » » GetMinWidth() const; | |
| 79 » virtual FX_FLOAT» » » GetMinHeight() const; | |
| 80 » //define layout order to 5. | |
| 81 » virtual int» » » » » GetLayoutOrder() const {
return 5; } | |
| 82 | 73 |
| 83 public: | 74 public: |
| 84 » CPDF_Annot*» » » » » GetPDFAnnot(); | 75 virtual FX_FLOAT GetMinWidth() const; |
| 76 virtual FX_FLOAT GetMinHeight() const; |
| 77 // define layout order to 5. |
| 78 virtual int GetLayoutOrder() const { return 5; } |
| 85 | 79 |
| 86 » void» » » » » » SetPage(CPDFSDK_PageView
* pPageView); | 80 public: |
| 87 » CPDFSDK_PageView*» » » GetPageView(); | 81 CPDF_Annot* GetPDFAnnot(); |
| 88 » FX_DWORD» » » » » GetFlags(); | |
| 89 | 82 |
| 90 » // Tab Order | 83 void SetPage(CPDFSDK_PageView* pPageView); |
| 91 » int» » » » » » » GetTabOrder(); | 84 CPDFSDK_PageView* GetPageView(); |
| 92 » void» » » » » » SetTabOrder(int iTabOrde
r); | 85 FX_DWORD GetFlags(); |
| 93 | 86 |
| 94 » // Selection | 87 // Tab Order |
| 95 » FX_BOOL»» » » » » IsSelected(); | 88 int GetTabOrder(); |
| 96 » void» » » » » » SetSelected(FX_BOOL bSel
ected); | 89 void SetTabOrder(int iTabOrder); |
| 97 | 90 |
| 98 » CFX_ByteString» » » » GetType() const; | 91 // Selection |
| 99 » virtual CFX_ByteString» » GetSubType() const; | 92 FX_BOOL IsSelected(); |
| 93 void SetSelected(FX_BOOL bSelected); |
| 100 | 94 |
| 101 » CPDF_Page*» » » » » GetPDFPage(); | 95 CFX_ByteString GetType() const; |
| 96 virtual CFX_ByteString GetSubType() const; |
| 102 | 97 |
| 103 public: | 98 CPDF_Page* GetPDFPage(); |
| 104 » CPDF_Dictionary*» » » GetAnnotDict() const; | |
| 105 | 99 |
| 106 » void» » » » » » SetRect(const CPDF_Rect&
rect); | 100 public: |
| 107 » CPDF_Rect» » » » » GetRect() const; | 101 CPDF_Dictionary* GetAnnotDict() const; |
| 108 | 102 |
| 109 » void» » » » » » SetContents(const CFX_Wi
deString& sContents); | 103 void SetRect(const CPDF_Rect& rect); |
| 110 » CFX_WideString» » » » GetContents() const; | 104 CPDF_Rect GetRect() const; |
| 111 | 105 |
| 112 » void» » » » » » SetAnnotName(const CFX_W
ideString& sName); | 106 void SetContents(const CFX_WideString& sContents); |
| 113 » CFX_WideString» » » » GetAnnotName() const; | 107 CFX_WideString GetContents() const; |
| 114 | 108 |
| 115 » void» » » » » » SetModifiedDate(const FX
_SYSTEMTIME& st); | 109 void SetAnnotName(const CFX_WideString& sName); |
| 116 » FX_SYSTEMTIME» » » » GetModifiedDate() const; | 110 CFX_WideString GetAnnotName() const; |
| 117 | 111 |
| 118 » void» » » » » » SetFlags(int nFlags); | 112 void SetModifiedDate(const FX_SYSTEMTIME& st); |
| 119 » int» » » » » » » GetFlags() const
; | 113 FX_SYSTEMTIME GetModifiedDate() const; |
| 120 | 114 |
| 121 » void» » » » » » SetAppState(const CFX_By
teString& str); | 115 void SetFlags(int nFlags); |
| 122 » CFX_ByteString» » » » GetAppState() const; | 116 int GetFlags() const; |
| 123 | 117 |
| 124 » void» » » » » » SetStructParent(int key)
; | 118 void SetAppState(const CFX_ByteString& str); |
| 125 » int» » » » » » » GetStructParent(
) const; | 119 CFX_ByteString GetAppState() const; |
| 126 | 120 |
| 127 » //border | 121 void SetStructParent(int key); |
| 128 » void» » » » » » SetBorderWidth(int nWidt
h); | 122 int GetStructParent() const; |
| 129 » int» » » » » » » GetBorderWidth()
const; | |
| 130 | 123 |
| 131 » //BBS_SOLID | 124 // border |
| 132 » //BBS_DASH | 125 void SetBorderWidth(int nWidth); |
| 133 » //BBS_BEVELED | 126 int GetBorderWidth() const; |
| 134 » //BBS_INSET | |
| 135 » //BBS_UNDERLINE | |
| 136 | 127 |
| 137 » void» » » » » » SetBorderStyle(int nStyl
e); | 128 // BBS_SOLID |
| 138 » int» » » » » » » GetBorderStyle()
const; | 129 // BBS_DASH |
| 130 // BBS_BEVELED |
| 131 // BBS_INSET |
| 132 // BBS_UNDERLINE |
| 139 | 133 |
| 140 » void» » » » » » SetBorderDash(const CFX_
IntArray& array); | 134 void SetBorderStyle(int nStyle); |
| 141 » void» » » » » » GetBorderDash(CFX_IntArr
ay& array) const; | 135 int GetBorderStyle() const; |
| 142 | 136 |
| 143 » //The background of the annotation's icon when closed | 137 void SetBorderDash(const CFX_IntArray& array); |
| 144 » //The title bar of the annotation's pop-up window | 138 void GetBorderDash(CFX_IntArray& array) const; |
| 145 » //The border of a link annotation | |
| 146 | 139 |
| 147 » void» » » » » » SetColor(FX_COLORREF col
or); | 140 // The background of the annotation's icon when closed |
| 148 » void» » » » » » RemoveColor(); | 141 // The title bar of the annotation's pop-up window |
| 149 » FX_BOOL»» » » » » GetColor(FX_COLORREF& co
lor) const; | 142 // The border of a link annotation |
| 150 | 143 |
| 151 » FX_BOOL»» » » » » IsVisible() const; | 144 void SetColor(FX_COLORREF color); |
| 152 » //action | 145 void RemoveColor(); |
| 146 FX_BOOL GetColor(FX_COLORREF& color) const; |
| 153 | 147 |
| 154 » CPDF_Action» » » » » GetAction() const; | 148 FX_BOOL IsVisible() const; |
| 155 » void» » » » » » SetAction(const CPDF_Act
ion& a); | 149 // action |
| 156 » void» » » » » » RemoveAction(); | |
| 157 | 150 |
| 158 » CPDF_AAction» » » » GetAAction() const; | 151 CPDF_Action GetAction() const; |
| 159 » void» » » » » » SetAAction(const CPDF_AA
ction& aa); | 152 void SetAction(const CPDF_Action& a); |
| 160 » void» » » » » » RemoveAAction(); | 153 void RemoveAction(); |
| 161 | 154 |
| 162 » virtual CPDF_Action» » » GetAAction(CPDF_AAction::AAction
Type eAAT); | 155 CPDF_AAction GetAAction() const; |
| 156 void SetAAction(const CPDF_AAction& aa); |
| 157 void RemoveAAction(); |
| 163 | 158 |
| 164 public: | 159 virtual CPDF_Action GetAAction(CPDF_AAction::AActionType eAAT); |
| 165 » FX_BOOL»» » » » » IsAppearanceValid(); | |
| 166 » FX_BOOL»» » » » » IsAppearanceValid(CPDF_A
nnot::AppearanceMode mode); | |
| 167 » void» » » » » » DrawAppearance(CFX_Rende
rDevice* pDevice, const CPDF_Matrix* pUser2Device, | |
| 168 » » CPDF_Annot::AppearanceMode mode, const CPDF_RenderOptions* pOpti
ons); | |
| 169 » void» » » » » » DrawBorder(CFX_RenderDev
ice* pDevice, const CPDF_Matrix* pUser2Device, | |
| 170 » » const CPDF_RenderOptions* pOptions); | |
| 171 | 160 |
| 172 » void» » » » » » ClearCachedAP(); | 161 public: |
| 162 FX_BOOL IsAppearanceValid(); |
| 163 FX_BOOL IsAppearanceValid(CPDF_Annot::AppearanceMode mode); |
| 164 void DrawAppearance(CFX_RenderDevice* pDevice, |
| 165 const CPDF_Matrix* pUser2Device, |
| 166 CPDF_Annot::AppearanceMode mode, |
| 167 const CPDF_RenderOptions* pOptions); |
| 168 void DrawBorder(CFX_RenderDevice* pDevice, |
| 169 const CPDF_Matrix* pUser2Device, |
| 170 const CPDF_RenderOptions* pOptions); |
| 173 | 171 |
| 174 » void» » » » » » WriteAppearance(const CF
X_ByteString& sAPType, const CPDF_Rect& rcBBox, | 172 void ClearCachedAP(); |
| 175 » » const CPDF_Matrix& matrix, const CFX_ByteString& sContents, | |
| 176 » » const CFX_ByteString& sAPState = ""); | |
| 177 | 173 |
| 178 public: | 174 void WriteAppearance(const CFX_ByteString& sAPType, |
| 179 » virtual void» » » Annot_OnDraw(CFX_RenderDevice* pDevice,
CPDF_Matrix* pUser2Device,CPDF_RenderOptions* pOptions); | 175 const CPDF_Rect& rcBBox, |
| 180 public: | 176 const CPDF_Matrix& matrix, |
| 177 const CFX_ByteString& sContents, |
| 178 const CFX_ByteString& sAPState = ""); |
| 181 | 179 |
| 180 public: |
| 181 virtual void Annot_OnDraw(CFX_RenderDevice* pDevice, |
| 182 CPDF_Matrix* pUser2Device, |
| 183 CPDF_RenderOptions* pOptions); |
| 182 | 184 |
| 183 private: | 185 public: |
| 184 » FX_BOOL CreateFormFiller(); | 186 private: |
| 185 protected: | 187 FX_BOOL CreateFormFiller(); |
| 186 » CPDF_Annot*» » » m_pAnnot; | |
| 187 » CPDFSDK_PageView*» m_pPageView; | |
| 188 » FX_BOOL»» » » m_bSelected; | |
| 189 » int» » » » » m_nTabOrder; | |
| 190 | 188 |
| 189 protected: |
| 190 CPDF_Annot* m_pAnnot; |
| 191 CPDFSDK_PageView* m_pPageView; |
| 192 FX_BOOL m_bSelected; |
| 193 int m_nTabOrder; |
| 191 }; | 194 }; |
| 192 | 195 |
| 193 #endif // FPDFSDK_INCLUDE_FSDK_BASEANNOT_H_ | 196 #endif // FPDFSDK_INCLUDE_FSDK_BASEANNOT_H_ |
| OLD | NEW |