| 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 CORE_INCLUDE_FPDFDOC_FPDF_DOC_H_ | 7 #ifndef CORE_INCLUDE_FPDFDOC_FPDF_DOC_H_ |
| 8 #define CORE_INCLUDE_FPDFDOC_FPDF_DOC_H_ | 8 #define CORE_INCLUDE_FPDFDOC_FPDF_DOC_H_ |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 class CPDF_LWinParam; | 35 class CPDF_LWinParam; |
| 36 class CPDF_Metadata; | 36 class CPDF_Metadata; |
| 37 class CPDF_NumberTree; | 37 class CPDF_NumberTree; |
| 38 class CPDF_OCContext; | 38 class CPDF_OCContext; |
| 39 class CPDF_Page; | 39 class CPDF_Page; |
| 40 class CPDF_RenderOptions; | 40 class CPDF_RenderOptions; |
| 41 class CPDF_TextObject; | 41 class CPDF_TextObject; |
| 42 class CPDF_ViewerPreferences; | 42 class CPDF_ViewerPreferences; |
| 43 class CXML_Element; | 43 class CXML_Element; |
| 44 | 44 |
| 45 class CPDF_NameTree | 45 class CPDF_NameTree { |
| 46 { | 46 public: |
| 47 public: | 47 CPDF_NameTree(CPDF_Dictionary* pRoot) { m_pRoot = pRoot; } |
| 48 | 48 |
| 49 CPDF_NameTree(CPDF_Dictionary* pRoot) | 49 CPDF_NameTree(CPDF_Document* pDoc, const CFX_ByteStringC& category); |
| 50 { | 50 |
| 51 m_pRoot = pRoot; | 51 CPDF_Object* LookupValue(int nIndex, CFX_ByteString& csName) const; |
| 52 } | 52 |
| 53 | 53 CPDF_Object* LookupValue(const CFX_ByteString& csName) const; |
| 54 CPDF_NameTree(CPDF_Document* pDoc, const CFX_ByteStringC& category); | 54 |
| 55 | 55 CPDF_Array* LookupNamedDest(CPDF_Document* pDoc, |
| 56 CPDF_Object* LookupValue(int nIndex, CFX_ByteString& csName)
const; | 56 const CFX_ByteStringC& sName); |
| 57 | 57 |
| 58 CPDF_Object* LookupValue(const CFX_ByteString& csName) const; | 58 int GetIndex(const CFX_ByteString& csName) const; |
| 59 | 59 |
| 60 CPDF_Array* LookupNamedDest(CPDF_Document* pDoc, const CFX_B
yteStringC& sName); | 60 int GetCount() const; |
| 61 | 61 |
| 62 int GetIndex(const CFX_ByteString& csName) c
onst; | 62 CPDF_Dictionary* GetRoot() const { return m_pRoot; } |
| 63 | 63 |
| 64 int GetCount() const; | 64 protected: |
| 65 | 65 CPDF_Dictionary* m_pRoot; |
| 66 | 66 }; |
| 67 CPDF_Dictionary* GetRoot() const | 67 class CPDF_BookmarkTree { |
| 68 { | 68 public: |
| 69 return m_pRoot; | 69 CPDF_BookmarkTree(CPDF_Document* pDoc) : m_pDocument(pDoc) {} |
| 70 } | 70 |
| 71 | 71 CPDF_Bookmark GetFirstChild(const CPDF_Bookmark& parent) const; |
| 72 protected: | 72 |
| 73 | 73 CPDF_Bookmark GetNextSibling(const CPDF_Bookmark& bookmark) const; |
| 74 CPDF_Dictionary* m_pRoot; | 74 |
| 75 }; | 75 CPDF_Document* GetDocument() const { return m_pDocument; } |
| 76 class CPDF_BookmarkTree | 76 |
| 77 { | 77 protected: |
| 78 public: | 78 CPDF_Document* m_pDocument; |
| 79 CPDF_BookmarkTree(CPDF_Document* pDoc) : m_pDocument(pDoc) {} | 79 }; |
| 80 | 80 #define PDFBOOKMARK_ITALIC 1 |
| 81 CPDF_Bookmark GetFirstChild(const CPDF_Bookmark& parent) const
; | 81 #define PDFBOOKMARK_BOLD 2 |
| 82 | 82 class CPDF_Bookmark { |
| 83 CPDF_Bookmark GetNextSibling(const CPDF_Bookmark& bookmark) co
nst; | 83 public: |
| 84 | 84 CPDF_Bookmark() : m_pDict(NULL) {} |
| 85 CPDF_Document* GetDocument() const { return m_pDocument; } | 85 |
| 86 | 86 explicit CPDF_Bookmark(CPDF_Dictionary* pDict) : m_pDict(pDict) {} |
| 87 protected: | 87 |
| 88 CPDF_Document* m_pDocument; | 88 CPDF_Dictionary* GetDict() const { return m_pDict; } |
| 89 }; | 89 |
| 90 #define PDFBOOKMARK_ITALIC 1 | 90 operator bool() const { return m_pDict != NULL; } |
| 91 #define PDFBOOKMARK_BOLD 2 | 91 |
| 92 class CPDF_Bookmark | 92 FX_DWORD GetColorRef() const; |
| 93 { | 93 |
| 94 public: | 94 FX_DWORD GetFontStyle() const; |
| 95 | 95 |
| 96 CPDF_Bookmark() : m_pDict(NULL) {} | 96 CFX_WideString GetTitle() const; |
| 97 | 97 |
| 98 explicit CPDF_Bookmark(CPDF_Dictionary* pDict) : m_pDict(pDict) {} | 98 CPDF_Dest GetDest(CPDF_Document* pDocument) const; |
| 99 | 99 |
| 100 CPDF_Dictionary* GetDict() const { return m_pDict; } | 100 CPDF_Action GetAction() const; |
| 101 | 101 |
| 102 operator bool() const { return m_pDict != NULL; } | 102 CPDF_Dictionary* m_pDict; |
| 103 | 103 }; |
| 104 FX_DWORD GetColorRef() const; | 104 #define PDFZOOM_XYZ 1 |
| 105 | 105 #define PDFZOOM_FITPAGE 2 |
| 106 FX_DWORD GetFontStyle() const; | 106 #define PDFZOOM_FITHORZ 3 |
| 107 | 107 #define PDFZOOM_FITVERT 4 |
| 108 CFX_WideString GetTitle() const; | 108 #define PDFZOOM_FITRECT 5 |
| 109 | 109 #define PDFZOOM_FITBBOX 6 |
| 110 CPDF_Dest GetDest(CPDF_Document* pDocument) const; | 110 #define PDFZOOM_FITBHORZ 7 |
| 111 | 111 #define PDFZOOM_FITBVERT 8 |
| 112 CPDF_Action GetAction() const; | 112 class CPDF_Dest { |
| 113 | 113 public: |
| 114 CPDF_Dictionary* m_pDict; | 114 CPDF_Dest() : m_pObj(nullptr) {} |
| 115 }; | 115 explicit CPDF_Dest(CPDF_Object* pObj) : m_pObj(pObj) {} |
| 116 #define PDFZOOM_XYZ 1 | 116 |
| 117 #define PDFZOOM_FITPAGE 2 | 117 operator bool() const { return m_pObj != NULL; } |
| 118 #define PDFZOOM_FITHORZ 3 | 118 CPDF_Object* GetObject() const { return m_pObj; } |
| 119 #define PDFZOOM_FITVERT 4 | 119 |
| 120 #define PDFZOOM_FITRECT 5 | 120 CFX_ByteString GetRemoteName(); |
| 121 #define PDFZOOM_FITBBOX 6 | 121 int GetPageIndex(CPDF_Document* pDoc); |
| 122 #define PDFZOOM_FITBHORZ 7 | 122 FX_DWORD GetPageObjNum(); |
| 123 #define PDFZOOM_FITBVERT 8 | 123 int GetZoomMode(); |
| 124 class CPDF_Dest | 124 FX_FLOAT GetParam(int index); |
| 125 { | 125 |
| 126 public: | 126 protected: |
| 127 CPDF_Dest() : m_pObj(nullptr) { } | 127 CPDF_Object* m_pObj; |
| 128 explicit CPDF_Dest(CPDF_Object* pObj) : m_pObj(pObj) { } | 128 }; |
| 129 | 129 class CPDF_OCContext : public IPDF_OCContext { |
| 130 operator bool () const { return m_pObj != NULL; } | 130 public: |
| 131 CPDF_Object* GetObject() const { return m_pObj; } | 131 enum UsageType { View = 0, Design, Print, Export }; |
| 132 | 132 |
| 133 CFX_ByteString GetRemoteName(); | 133 CPDF_OCContext(CPDF_Document* pDoc, UsageType eUsageType = View); |
| 134 int GetPageIndex(CPDF_Document* pDoc); | 134 |
| 135 FX_DWORD GetPageObjNum(); | 135 virtual ~CPDF_OCContext(); |
| 136 int GetZoomMode(); | 136 |
| 137 FX_FLOAT GetParam(int index); | 137 CPDF_Document* GetDocument() const { return m_pDocument; } |
| 138 | 138 |
| 139 protected: | 139 UsageType GetUsageType() const { return m_eUsageType; } |
| 140 CPDF_Object* m_pObj; | 140 |
| 141 }; | 141 FX_BOOL CheckOCGVisible(const CPDF_Dictionary* pOCGDict); |
| 142 class CPDF_OCContext : public IPDF_OCContext | 142 |
| 143 { | 143 void ResetOCContext(); |
| 144 public: | 144 |
| 145 | 145 protected: |
| 146 enum UsageType { | 146 FX_BOOL LoadOCGStateFromConfig(const CFX_ByteStringC& csConfig, |
| 147 View = 0, | 147 const CPDF_Dictionary* pOCGDict, |
| 148 Design, | 148 FX_BOOL& bValidConfig) const; |
| 149 Print, | 149 |
| 150 Export | 150 FX_BOOL LoadOCGState(const CPDF_Dictionary* pOCGDict) const; |
| 151 }; | 151 |
| 152 | 152 FX_BOOL GetOCGVisible(const CPDF_Dictionary* pOCGDict); |
| 153 CPDF_OCContext(CPDF_Document *pDoc, UsageType eUsageType = View); | 153 |
| 154 | 154 FX_BOOL GetOCGVE(CPDF_Array* pExpression, |
| 155 virtual ~CPDF_OCContext(); | 155 FX_BOOL bFromConfig, |
| 156 | 156 int nLevel = 0); |
| 157 CPDF_Document* GetDocument() const | 157 |
| 158 { | 158 FX_BOOL LoadOCMDState(const CPDF_Dictionary* pOCMDDict, FX_BOOL bFromConfig); |
| 159 return m_pDocument; | 159 |
| 160 } | 160 CPDF_Document* m_pDocument; |
| 161 | 161 |
| 162 UsageType GetUsageType() const | 162 UsageType m_eUsageType; |
| 163 { | 163 |
| 164 return m_eUsageType; | 164 std::map<const CPDF_Dictionary*, FX_BOOL> m_OCGStates; |
| 165 } | 165 }; |
| 166 | 166 class CPDF_LWinParam { |
| 167 FX_BOOL CheckOCGVisible(const CPDF_Dictionary *pOCGDict)
; | 167 public: |
| 168 | 168 CPDF_LWinParam(CPDF_Dictionary* pDict) { m_pDict = pDict; } |
| 169 void ResetOCContext(); | 169 |
| 170 protected: | 170 operator CPDF_Dictionary*() const { return m_pDict; } |
| 171 | 171 |
| 172 FX_BOOL LoadOCGStateFromConfig(const CFX_ByteStringC& cs
Config, const CPDF_Dictionary *pOCGDict, FX_BOOL &bValidConfig) const; | 172 inline CFX_ByteString GetFileName() { return m_pDict->GetString("F"); } |
| 173 | 173 |
| 174 FX_BOOL LoadOCGState(const CPDF_Dictionary *pOCGDict) co
nst; | 174 inline CFX_ByteString GetDefaultDirectory() { |
| 175 | 175 return m_pDict->GetString("D"); |
| 176 FX_BOOL GetOCGVisible(const CPDF_Dictionary *pOCGDict); | 176 } |
| 177 | 177 |
| 178 FX_BOOL GetOCGVE(CPDF_Array *pExpression, FX_BOOL bFromC
onfig, int nLevel = 0); | 178 inline CFX_ByteString GetOperation() { return m_pDict->GetString("O"); } |
| 179 | 179 |
| 180 FX_BOOL LoadOCMDState(const CPDF_Dictionary *pOCMDDict,
FX_BOOL bFromConfig); | 180 inline CFX_ByteString GetParameter() { return m_pDict->GetString("P"); } |
| 181 | 181 |
| 182 CPDF_Document *m_pDocument; | 182 CPDF_Dictionary* m_pDict; |
| 183 | 183 }; |
| 184 UsageType m_eUsageType; | 184 class CPDF_ActionFields { |
| 185 | 185 public: |
| 186 std::map<const CPDF_Dictionary*, FX_BOOL> m_OCGStates; | 186 CPDF_ActionFields(const CPDF_Action* pAction) { |
| 187 }; | 187 m_pAction = (CPDF_Action*)pAction; |
| 188 class CPDF_LWinParam | 188 } |
| 189 { | 189 |
| 190 public: | 190 operator CPDF_Action*() const { return m_pAction; } |
| 191 | 191 |
| 192 CPDF_LWinParam(CPDF_Dictionary* pDict) | 192 FX_DWORD GetFieldsCount() const; |
| 193 { | 193 |
| 194 m_pDict = pDict; | 194 void GetAllFields(CFX_PtrArray& fieldObjects) const; |
| 195 } | 195 |
| 196 | 196 CPDF_Object* GetField(FX_DWORD iIndex) const; |
| 197 operator CPDF_Dictionary* () const | 197 |
| 198 { | 198 CPDF_Action* m_pAction; |
| 199 return m_pDict; | 199 }; |
| 200 } | 200 |
| 201 | 201 #define PDFNAMED_NEXTPAGE 1 |
| 202 inline CFX_ByteString GetFileName() | 202 #define PDFNAMED_PREVPAGE 2 |
| 203 { | 203 #define PDFNAMED_FIRSTPAGE 3 |
| 204 return m_pDict->GetString("F"); | 204 #define PDFNAMED_LASTPAGE 4 |
| 205 } | 205 #define PDFJS_MAXLENGTH 64 |
| 206 | 206 class CPDF_Action { |
| 207 | 207 public: |
| 208 inline CFX_ByteString GetDefaultDirectory() | 208 enum ActionType { |
| 209 { | 209 Unknown = 0, |
| 210 return m_pDict->GetString("D"); | 210 GoTo, |
| 211 } | 211 GoToR, |
| 212 | 212 GoToE, |
| 213 | 213 Launch, |
| 214 inline CFX_ByteString GetOperation() | 214 Thread, |
| 215 { | 215 URI, |
| 216 return m_pDict->GetString("O"); | 216 Sound, |
| 217 } | 217 Movie, |
| 218 | 218 Hide, |
| 219 | 219 Named, |
| 220 inline CFX_ByteString GetParameter() | 220 SubmitForm, |
| 221 { | 221 ResetForm, |
| 222 return m_pDict->GetString("P"); | 222 ImportData, |
| 223 } | 223 JavaScript, |
| 224 | 224 SetOCGState, |
| 225 CPDF_Dictionary* m_pDict; | 225 Rendition, |
| 226 }; | 226 Trans, |
| 227 class CPDF_ActionFields | 227 GoTo3DView |
| 228 { | 228 }; |
| 229 public: | 229 |
| 230 | 230 CPDF_Action() : m_pDict(nullptr) {} |
| 231 CPDF_ActionFields(const CPDF_Action* pAction) | 231 explicit CPDF_Action(CPDF_Dictionary* pDict) : m_pDict(pDict) {} |
| 232 { | 232 |
| 233 m_pAction = (CPDF_Action*)pAction; | 233 operator bool() const { return m_pDict != NULL; } |
| 234 } | 234 |
| 235 | 235 CPDF_Dictionary* GetDict() const { return m_pDict; } |
| 236 operator CPDF_Action*() const | 236 |
| 237 { | 237 CFX_ByteString GetTypeName() const { return m_pDict->GetString("S"); } |
| 238 return m_pAction; | 238 |
| 239 } | 239 ActionType GetType() const; |
| 240 | 240 |
| 241 FX_DWORD GetFieldsCount() const; | 241 CPDF_Dest GetDest(CPDF_Document* pDoc) const; |
| 242 | 242 |
| 243 void GetAllFields(CFX_PtrArray& field
Objects) const; | 243 CFX_WideString GetFilePath() const; |
| 244 | 244 |
| 245 CPDF_Object* GetField(FX_DWORD iIndex) const; | 245 FX_BOOL GetNewWindow() const { return m_pDict->GetBoolean("NewWindow"); } |
| 246 | 246 |
| 247 CPDF_Action* m_pAction; | 247 CPDF_LWinParam GetWinParam() const; |
| 248 }; | 248 |
| 249 | 249 CFX_ByteString GetURI(CPDF_Document* pDoc) const; |
| 250 #define PDFNAMED_NEXTPAGE 1 | 250 |
| 251 #define PDFNAMED_PREVPAGE 2 | 251 FX_BOOL GetMouseMap() const { return m_pDict->GetBoolean("IsMap"); } |
| 252 #define PDFNAMED_FIRSTPAGE 3 | 252 |
| 253 #define PDFNAMED_LASTPAGE 4 | 253 CPDF_ActionFields GetWidgets() const { return this; } |
| 254 #define PDFJS_MAXLENGTH 64 | 254 |
| 255 class CPDF_Action | 255 FX_BOOL GetHideStatus() const { return m_pDict->GetBoolean("H", TRUE); } |
| 256 { | 256 |
| 257 public: | 257 CFX_ByteString GetNamedAction() const { return m_pDict->GetString("N"); } |
| 258 enum ActionType { | 258 |
| 259 Unknown = 0, | 259 FX_DWORD GetFlags() const { return m_pDict->GetInteger("Flags"); } |
| 260 GoTo, | 260 |
| 261 GoToR, | 261 CFX_WideString GetJavaScript() const; |
| 262 GoToE, | 262 |
| 263 Launch, | 263 CPDF_Dictionary* GetAnnot() const; |
| 264 Thread, | 264 |
| 265 URI, | 265 int32_t GetOperationType() const; |
| 266 Sound, | 266 |
| 267 Movie, | 267 CPDF_Stream* GetSoundStream() const { return m_pDict->GetStream("Sound"); } |
| 268 Hide, | 268 |
| 269 Named, | 269 FX_FLOAT GetVolume() const { return m_pDict->GetNumber("Volume"); } |
| 270 SubmitForm, | 270 |
| 271 ResetForm, | 271 FX_BOOL IsSynchronous() const { return m_pDict->GetBoolean("Synchronous"); } |
| 272 ImportData, | 272 |
| 273 JavaScript, | 273 FX_BOOL IsRepeat() const { return m_pDict->GetBoolean("Repeat"); } |
| 274 SetOCGState, | 274 |
| 275 Rendition, | 275 FX_BOOL IsMixPlay() const { return m_pDict->GetBoolean("Mix"); } |
| 276 Trans, | 276 |
| 277 GoTo3DView | 277 FX_DWORD GetSubActionsCount() const; |
| 278 }; | 278 |
| 279 | 279 CPDF_Action GetSubAction(FX_DWORD iIndex) const; |
| 280 CPDF_Action() : m_pDict(nullptr) { } | 280 |
| 281 explicit CPDF_Action(CPDF_Dictionary* pDict) : m_pDict(pDict) { } | 281 protected: |
| 282 | 282 CPDF_Dictionary* m_pDict; |
| 283 operator bool () const { return m_pDict != NULL; } | 283 }; |
| 284 | 284 class CPDF_AAction { |
| 285 CPDF_Dictionary* GetDict() const { return m_pDict; } | 285 public: |
| 286 | 286 CPDF_AAction(CPDF_Dictionary* pDict = NULL) { m_pDict = pDict; } |
| 287 CFX_ByteString GetTypeName() const | 287 |
| 288 { | 288 operator CPDF_Dictionary*() const { return m_pDict; } |
| 289 return m_pDict->GetString("S"); | 289 |
| 290 } | 290 enum AActionType { |
| 291 | 291 CursorEnter = 0, |
| 292 ActionType GetType() const; | 292 CursorExit, |
| 293 | 293 ButtonDown, |
| 294 CPDF_Dest GetDest(CPDF_Document* pDoc) const; | 294 ButtonUp, |
| 295 | 295 GetFocus, |
| 296 CFX_WideString GetFilePath() const; | 296 LoseFocus, |
| 297 | 297 PageOpen, |
| 298 FX_BOOL GetNewWindow() const | 298 PageClose, |
| 299 { | 299 PageVisible, |
| 300 return m_pDict->GetBoolean("NewWindow"); | 300 PageInvisible, |
| 301 } | 301 OpenPage, |
| 302 | 302 ClosePage, |
| 303 CPDF_LWinParam GetWinParam() const; | 303 KeyStroke, |
| 304 | 304 Format, |
| 305 CFX_ByteString GetURI(CPDF_Document* pDoc) const; | 305 Validate, |
| 306 | 306 Calculate, |
| 307 FX_BOOL GetMouseMap() const | 307 CloseDocument, |
| 308 { | 308 SaveDocument, |
| 309 return m_pDict->GetBoolean("IsMap"); | 309 DocumentSaved, |
| 310 } | 310 PrintDocument, |
| 311 | 311 DocumentPrinted |
| 312 CPDF_ActionFields GetWidgets() const | 312 }; |
| 313 { | 313 |
| 314 return this; | 314 FX_BOOL ActionExist(AActionType eType) const; |
| 315 } | 315 |
| 316 | 316 CPDF_Action GetAction(AActionType eType) const; |
| 317 FX_BOOL GetHideStatus() const | 317 |
| 318 { | 318 FX_POSITION GetStartPos() const; |
| 319 return m_pDict->GetBoolean("H", TRUE); | 319 |
| 320 } | 320 CPDF_Action GetNextAction(FX_POSITION& pos, AActionType& eType) const; |
| 321 | 321 |
| 322 CFX_ByteString GetNamedAction() const | 322 CPDF_Dictionary* m_pDict; |
| 323 { | 323 }; |
| 324 return m_pDict->GetString("N"); | 324 class CPDF_DocJSActions { |
| 325 } | 325 public: |
| 326 | 326 CPDF_DocJSActions(CPDF_Document* pDoc); |
| 327 FX_DWORD GetFlags() const | 327 |
| 328 { | 328 int CountJSActions() const; |
| 329 return m_pDict->GetInteger("Flags"); | 329 |
| 330 } | 330 CPDF_Action GetJSAction(int index, CFX_ByteString& csName) const; |
| 331 | 331 |
| 332 CFX_WideString GetJavaScript() const; | 332 CPDF_Action GetJSAction(const CFX_ByteString& csName) const; |
| 333 | 333 |
| 334 CPDF_Dictionary* GetAnnot() const; | 334 int FindJSAction(const CFX_ByteString& csName) const; |
| 335 | 335 |
| 336 int32_t GetOperationType() const; | 336 CPDF_Document* GetDocument() const { return m_pDocument; } |
| 337 | 337 |
| 338 CPDF_Stream* GetSoundStream() const | 338 protected: |
| 339 { | 339 CPDF_Document* m_pDocument; |
| 340 return m_pDict->GetStream("Sound"); | 340 }; |
| 341 } | 341 class CPDF_FileSpec { |
| 342 | 342 public: |
| 343 FX_FLOAT GetVolume() const | 343 CPDF_FileSpec(); |
| 344 { | 344 |
| 345 return m_pDict->GetNumber("Volume"); | 345 CPDF_FileSpec(CPDF_Object* pObj) { m_pObj = pObj; } |
| 346 } | 346 |
| 347 | 347 operator CPDF_Object*() const { return m_pObj; } |
| 348 FX_BOOL IsSynchronous() const | 348 |
| 349 { | 349 FX_BOOL IsURL() const; |
| 350 return m_pDict->GetBoolean("Synchronous"); | 350 |
| 351 } | 351 FX_BOOL GetFileName(CFX_WideString& wsFileName) const; |
| 352 | 352 |
| 353 FX_BOOL IsRepeat() const | 353 CPDF_Stream* GetFileStream() const; |
| 354 { | 354 |
| 355 return m_pDict->GetBoolean("Repeat"); | 355 void SetFileName(const CFX_WideStringC& wsFileName, FX_BOOL bURL = FALSE); |
| 356 } | 356 |
| 357 | 357 protected: |
| 358 FX_BOOL IsMixPlay() const | 358 CPDF_Object* m_pObj; |
| 359 { | 359 }; |
| 360 return m_pDict->GetBoolean("Mix"); | 360 class CPDF_LinkList { |
| 361 } | 361 public: |
| 362 | 362 CPDF_LinkList(CPDF_Document* pDoc) { m_pDocument = pDoc; } |
| 363 FX_DWORD GetSubActionsCount() const; | 363 |
| 364 | 364 ~CPDF_LinkList(); |
| 365 CPDF_Action GetSubAction(FX_DWORD iIndex) const; | 365 |
| 366 | 366 CPDF_Link GetLinkAtPoint(CPDF_Page* pPage, FX_FLOAT pdf_x, FX_FLOAT pdf_y); |
| 367 protected: | 367 |
| 368 CPDF_Dictionary* m_pDict; | 368 int CountLinks(CPDF_Page* pPage); |
| 369 }; | 369 |
| 370 class CPDF_AAction | 370 CPDF_Link GetLink(CPDF_Page* pPage, int index); |
| 371 { | 371 |
| 372 public: | 372 CPDF_Document* GetDocument() const { return m_pDocument; } |
| 373 | 373 |
| 374 CPDF_AAction(CPDF_Dictionary* pDict = NULL) | 374 protected: |
| 375 { | 375 CPDF_Document* m_pDocument; |
| 376 m_pDict = pDict; | 376 |
| 377 } | 377 CFX_MapPtrToPtr m_PageMap; |
| 378 | 378 |
| 379 operator CPDF_Dictionary*() const | 379 CFX_PtrArray* GetPageLinks(CPDF_Page* pPage); |
| 380 { | 380 |
| 381 return m_pDict; | 381 void LoadPageLinks(CPDF_Page* pPage, CFX_PtrArray* pList); |
| 382 } | 382 }; |
| 383 | 383 class CPDF_Link { |
| 384 enum AActionType { | 384 public: |
| 385 CursorEnter = 0, | 385 CPDF_Link() : m_pDict(nullptr) {} |
| 386 CursorExit, | 386 explicit CPDF_Link(CPDF_Dictionary* pDict) : m_pDict(pDict) {} |
| 387 ButtonDown, | 387 |
| 388 ButtonUp, | 388 CPDF_Dictionary* GetDict() const { return m_pDict; } |
| 389 GetFocus, | 389 |
| 390 LoseFocus, | 390 CFX_FloatRect GetRect(); |
| 391 PageOpen, | 391 CPDF_Dest GetDest(CPDF_Document* pDoc); |
| 392 PageClose, | 392 CPDF_Action GetAction(); |
| 393 PageVisible, | 393 |
| 394 PageInvisible, | 394 protected: |
| 395 OpenPage, | 395 CPDF_Dictionary* m_pDict; |
| 396 ClosePage, | 396 }; |
| 397 KeyStroke, | 397 |
| 398 Format, | 398 #define ANNOTFLAG_INVISIBLE 0x0001 |
| 399 Validate, | 399 #define ANNOTFLAG_HIDDEN 0x0002 |
| 400 Calculate, | 400 #define ANNOTFLAG_PRINT 0x0004 |
| 401 CloseDocument, | 401 #define ANNOTFLAG_NOZOOM 0x0008 |
| 402 SaveDocument, | 402 #define ANNOTFLAG_NOROTATE 0x0010 |
| 403 DocumentSaved, | 403 #define ANNOTFLAG_NOVIEW 0x0020 |
| 404 PrintDocument, | 404 #define ANNOTFLAG_READONLY 0x0040 |
| 405 DocumentPrinted | 405 #define ANNOTFLAG_LOCKED 0x0080 |
| 406 }; | 406 #define ANNOTFLAG_TOGGLENOVIEW 0x0100 |
| 407 | 407 |
| 408 FX_BOOL ActionExist(AActionType eType) const; | 408 class CPDF_Annot : public CFX_PrivateData { |
| 409 | 409 public: |
| 410 CPDF_Action GetAction(AActionType eType) const; | 410 enum AppearanceMode { Normal, Rollover, Down }; |
| 411 | 411 |
| 412 FX_POSITION GetStartPos() const; | 412 CPDF_Annot(CPDF_Dictionary* pDict, CPDF_AnnotList* pList); |
| 413 | 413 ~CPDF_Annot(); |
| 414 CPDF_Action GetNextAction(FX_POSITION& pos, AActionType& eTy
pe) const; | 414 |
| 415 | 415 CFX_ByteString GetSubType() const; |
| 416 CPDF_Dictionary* m_pDict; | 416 |
| 417 }; | 417 FX_DWORD GetFlags() const; |
| 418 class CPDF_DocJSActions | 418 |
| 419 { | 419 void GetRect(CFX_FloatRect& rect) const; |
| 420 public: | 420 |
| 421 CPDF_DocJSActions(CPDF_Document* pDoc); | 421 CPDF_Dictionary* GetAnnotDict(); |
| 422 | 422 |
| 423 | 423 FX_BOOL DrawAppearance(const CPDF_Page* pPage, |
| 424 int CountJSActions() const; | 424 CFX_RenderDevice* pDevice, |
| 425 | 425 const CFX_AffineMatrix* pUser2Device, |
| 426 CPDF_Action GetJSAction(int index, CFX_ByteString& csName) c
onst; | 426 AppearanceMode mode, |
| 427 | 427 const CPDF_RenderOptions* pOptions); |
| 428 CPDF_Action GetJSAction(const CFX_ByteString& csName) const; | 428 |
| 429 | 429 FX_BOOL DrawInContext(const CPDF_Page* pPage, |
| 430 int FindJSAction(const CFX_ByteString& csNam
e) const; | 430 const CPDF_RenderContext* pContext, |
| 431 | 431 const CFX_AffineMatrix* pUser2Device, |
| 432 | 432 AppearanceMode mode); |
| 433 CPDF_Document* GetDocument() const | 433 |
| 434 { | 434 void ClearCachedAP(); |
| 435 return m_pDocument; | 435 |
| 436 } | 436 void DrawBorder(CFX_RenderDevice* pDevice, |
| 437 | 437 const CFX_AffineMatrix* pUser2Device, |
| 438 protected: | 438 const CPDF_RenderOptions* pOptions); |
| 439 | 439 |
| 440 CPDF_Document* m_pDocument; | 440 CPDF_Form* GetAPForm(const CPDF_Page* pPage, AppearanceMode mode); |
| 441 }; | 441 |
| 442 class CPDF_FileSpec | 442 private: |
| 443 { | 443 CPDF_Dictionary* const m_pAnnotDict; |
| 444 public: | 444 |
| 445 | 445 CPDF_AnnotList* const m_pList; |
| 446 CPDF_FileSpec(); | 446 |
| 447 | 447 const CFX_ByteString m_sSubtype; |
| 448 CPDF_FileSpec(CPDF_Object *pObj) | 448 |
| 449 { | 449 CFX_MapPtrToPtr m_APMap; |
| 450 m_pObj = pObj; | 450 }; |
| 451 } | 451 |
| 452 | 452 class CPDF_AnnotList { |
| 453 operator CPDF_Object*() const | 453 public: |
| 454 { | 454 CPDF_AnnotList(CPDF_Page* pPage); |
| 455 return m_pObj; | 455 |
| 456 } | 456 ~CPDF_AnnotList(); |
| 457 | 457 |
| 458 FX_BOOL IsURL() const; | 458 void GetAnnotMatrix(const CPDF_Dictionary* pAnnotDict, |
| 459 | 459 const CFX_Matrix* pUser2Device, |
| 460 FX_BOOL GetFileName(CFX_WideString &wsFileName) const; | 460 CFX_Matrix& matrix) const; |
| 461 | 461 |
| 462 CPDF_Stream* GetFileStream() const; | 462 void GetAnnotRect(const CPDF_Dictionary* pAnnotDict, |
| 463 | 463 const CFX_Matrix* pUser2Device, |
| 464 void SetFileName(const CFX_WideStringC& wsFileName, F
X_BOOL bURL = FALSE); | 464 CPDF_Rect& rtAnnot) const; |
| 465 protected: | 465 |
| 466 | 466 void DisplayAnnots(const CPDF_Page* pPage, |
| 467 CPDF_Object *m_pObj; | 467 CFX_RenderDevice* pDevice, |
| 468 }; | 468 CFX_AffineMatrix* pMatrix, |
| 469 class CPDF_LinkList | 469 FX_BOOL bShowWidget, |
| 470 { | 470 CPDF_RenderOptions* pOptions); |
| 471 public: | 471 |
| 472 | 472 void DisplayAnnots(const CPDF_Page* pPage, |
| 473 CPDF_LinkList(CPDF_Document* pDoc) | 473 CPDF_RenderContext* pContext, |
| 474 { | 474 FX_BOOL bPrinting, |
| 475 m_pDocument = pDoc; | 475 CFX_AffineMatrix* pMatrix, |
| 476 } | 476 FX_BOOL bShowWidget, |
| 477 | 477 CPDF_RenderOptions* pOptions) { |
| 478 ~CPDF_LinkList(); | 478 DisplayAnnots(pPage, NULL, pContext, bPrinting, pMatrix, |
| 479 | 479 bShowWidget ? 3 : 1, pOptions, NULL); |
| 480 CPDF_Link GetLinkAtPoint(CPDF_Page* pPage, FX_FLOAT pdf_x,
FX_FLOAT pdf_y); | 480 } |
| 481 | 481 |
| 482 int CountLinks(CPDF_Page* pPage); | 482 void DisplayAnnots(const CPDF_Page* pPage, |
| 483 | 483 CPDF_RenderContext* pContext, |
| 484 CPDF_Link GetLink(CPDF_Page* pPage, int index); | 484 FX_BOOL bPrinting, |
| 485 | 485 CFX_AffineMatrix* pMatrix, |
| 486 CPDF_Document* GetDocument() const | 486 FX_BOOL bShowWidget, |
| 487 { | 487 CPDF_RenderOptions* pOptions, |
| 488 return m_pDocument; | 488 FX_RECT* pClipRect) { |
| 489 } | 489 DisplayAnnots(pPage, NULL, pContext, bPrinting, pMatrix, |
| 490 protected: | 490 bShowWidget ? 3 : 1, pOptions, pClipRect); |
| 491 | 491 } |
| 492 CPDF_Document* m_pDocument; | 492 |
| 493 | 493 void DisplayAnnots(const CPDF_Page* pPage, |
| 494 CFX_MapPtrToPtr m_PageMap; | 494 CFX_RenderDevice* pDevice, |
| 495 | 495 CPDF_RenderContext* pContext, |
| 496 CFX_PtrArray* GetPageLinks(CPDF_Page* pPage); | 496 FX_BOOL bPrinting, |
| 497 | 497 CFX_AffineMatrix* pMatrix, |
| 498 void LoadPageLinks(CPDF_Page* pPage, CFX_PtrA
rray* pList); | 498 FX_DWORD dwAnnotFlags, |
| 499 }; | 499 CPDF_RenderOptions* pOptions, |
| 500 class CPDF_Link | 500 FX_RECT* pClipRect); |
| 501 { | 501 |
| 502 public: | 502 CPDF_Annot* GetAt(int index) { return (CPDF_Annot*)m_AnnotList.GetAt(index); } |
| 503 CPDF_Link() : m_pDict(nullptr) { } | 503 |
| 504 explicit CPDF_Link(CPDF_Dictionary* pDict) : m_pDict(pDict) { } | 504 int Count() { return m_AnnotList.GetSize(); } |
| 505 | 505 |
| 506 CPDF_Dictionary* GetDict() const { return m_pDict; } | 506 int GetIndex(CPDF_Annot* pAnnot); |
| 507 | 507 |
| 508 CFX_FloatRect GetRect(); | 508 CPDF_Document* GetDocument() const { return m_pDocument; } |
| 509 CPDF_Dest GetDest(CPDF_Document* pDoc); | 509 |
| 510 CPDF_Action GetAction(); | 510 protected: |
| 511 | 511 CFX_PtrArray m_AnnotList; |
| 512 protected: | 512 |
| 513 CPDF_Dictionary* m_pDict; | 513 CPDF_Dictionary* m_pPageDict; |
| 514 }; | 514 |
| 515 | 515 CPDF_Document* m_pDocument; |
| 516 #define ANNOTFLAG_INVISIBLE 0x0001 | 516 |
| 517 #define ANNOTFLAG_HIDDEN 0x0002 | 517 CFX_PtrArray m_Borders; |
| 518 #define ANNOTFLAG_PRINT 0x0004 | 518 |
| 519 #define ANNOTFLAG_NOZOOM 0x0008 | 519 void DisplayPass(const CPDF_Page* pPage, |
| 520 #define ANNOTFLAG_NOROTATE 0x0010 | 520 CFX_RenderDevice* pDevice, |
| 521 #define ANNOTFLAG_NOVIEW 0x0020 | 521 CPDF_RenderContext* pContext, |
| 522 #define ANNOTFLAG_READONLY 0x0040 | 522 FX_BOOL bPrinting, |
| 523 #define ANNOTFLAG_LOCKED 0x0080 | 523 CFX_AffineMatrix* pMatrix, |
| 524 #define ANNOTFLAG_TOGGLENOVIEW 0x0100 | 524 FX_BOOL bWidget, |
| 525 | 525 CPDF_RenderOptions* pOptions, |
| 526 class CPDF_Annot : public CFX_PrivateData | 526 FX_RECT* clip_rect); |
| 527 { | 527 friend class CPDF_Annot; |
| 528 public: | 528 }; |
| 529 enum AppearanceMode { | 529 #define COLORTYPE_TRANSPARENT 0 |
| 530 Normal, | 530 #define COLORTYPE_GRAY 1 |
| 531 Rollover, | 531 #define COLORTYPE_RGB 2 |
| 532 Down | 532 #define COLORTYPE_CMYK 3 |
| 533 }; | 533 class CPDF_DefaultAppearance { |
| 534 | 534 public: |
| 535 CPDF_Annot(CPDF_Dictionary* pDict, CPDF_AnnotList* pList); | 535 CPDF_DefaultAppearance(const CFX_ByteString& csDA = "") { m_csDA = csDA; } |
| 536 ~CPDF_Annot(); | 536 |
| 537 | 537 CPDF_DefaultAppearance(const CPDF_DefaultAppearance& cDA) { |
| 538 CFX_ByteString GetSubType() const; | 538 m_csDA = (CFX_ByteString)(CPDF_DefaultAppearance&)cDA; |
| 539 | 539 } |
| 540 FX_DWORD GetFlags() const; | 540 |
| 541 | 541 operator CFX_ByteString() const { return m_csDA; } |
| 542 void GetRect(CFX_FloatRect& rect) const; | 542 |
| 543 | 543 const CPDF_DefaultAppearance& operator=(const CFX_ByteString& csDA) { |
| 544 CPDF_Dictionary* GetAnnotDict(); | 544 m_csDA = csDA; |
| 545 | 545 return *this; |
| 546 FX_BOOL DrawAppearance(const CPDF_Page* pPage, | 546 } |
| 547 CFX_RenderDevice* pDevice, | 547 |
| 548 const CFX_AffineMatrix* pUser2Device, | 548 const CPDF_DefaultAppearance& operator=(const CPDF_DefaultAppearance& cDA) { |
| 549 AppearanceMode mode, | 549 m_csDA = (CFX_ByteString)(CPDF_DefaultAppearance&)cDA; |
| 550 const CPDF_RenderOptions* pOptions); | 550 return *this; |
| 551 | 551 } |
| 552 FX_BOOL DrawInContext(const CPDF_Page* pPage, | 552 |
| 553 const CPDF_RenderContext* pContext, | 553 FX_BOOL HasFont(); |
| 554 const CFX_AffineMatrix* pUser2Device, | 554 |
| 555 AppearanceMode mode); | 555 CFX_ByteString GetFontString(); |
| 556 | 556 |
| 557 void ClearCachedAP(); | 557 void GetFont(CFX_ByteString& csFontNameTag, FX_FLOAT& fFontSize); |
| 558 | 558 |
| 559 void DrawBorder(CFX_RenderDevice* pDevice, | 559 FX_BOOL HasColor(FX_BOOL bStrokingOperation = FALSE); |
| 560 const CFX_AffineMatrix* pUser2Device, | 560 |
| 561 const CPDF_RenderOptions* pOptions); | 561 CFX_ByteString GetColorString(FX_BOOL bStrokingOperation = FALSE); |
| 562 | 562 |
| 563 CPDF_Form* GetAPForm(const CPDF_Page* pPage, AppearanceMode mode); | 563 void GetColor(int& iColorType, |
| 564 | 564 FX_FLOAT fc[4], |
| 565 private: | 565 FX_BOOL bStrokingOperation = FALSE); |
| 566 CPDF_Dictionary* const m_pAnnotDict; | 566 |
| 567 | 567 void GetColor(FX_ARGB& color, |
| 568 CPDF_AnnotList* const m_pList; | 568 int& iColorType, |
| 569 | 569 FX_BOOL bStrokingOperation = FALSE); |
| 570 const CFX_ByteString m_sSubtype; | 570 |
| 571 | 571 FX_BOOL HasTextMatrix(); |
| 572 CFX_MapPtrToPtr m_APMap; | 572 |
| 573 }; | 573 CFX_ByteString GetTextMatrixString(); |
| 574 | 574 |
| 575 class CPDF_AnnotList | 575 CFX_AffineMatrix GetTextMatrix(); |
| 576 { | 576 |
| 577 public: | 577 protected: |
| 578 | 578 CFX_ByteString m_csDA; |
| 579 CPDF_AnnotList(CPDF_Page* pPage); | 579 }; |
| 580 | 580 #define FIELDTYPE_UNKNOWN 0 |
| 581 ~CPDF_AnnotList(); | 581 #define FIELDTYPE_PUSHBUTTON 1 |
| 582 | 582 #define FIELDTYPE_CHECKBOX 2 |
| 583 void GetAnnotMatrix(const CPDF_Dictionary* pAnnotDict, const CFX_Matr
ix* pUser2Device, CFX_Matrix &matrix) const; | 583 #define FIELDTYPE_RADIOBUTTON 3 |
| 584 | 584 #define FIELDTYPE_COMBOBOX 4 |
| 585 void GetAnnotRect(const CPDF_Dictionary* pAnnotDict, const CFX_Matrix
* pUser2Device, CPDF_Rect &rtAnnot) const; | 585 #define FIELDTYPE_LISTBOX 5 |
| 586 | 586 #define FIELDTYPE_TEXTFIELD 6 |
| 587 void DisplayAnnots(const CPDF_Page* pPage, CF
X_RenderDevice* pDevice, | 587 #define FIELDTYPE_SIGNATURE 7 |
| 588 CFX_AffineMatrix* pMatrix, FX_BOOL bShowWi
dget, | 588 class CPDF_InterForm : public CFX_PrivateData { |
| 589 CPDF_RenderOptions* pOptions); | 589 public: |
| 590 | 590 CPDF_InterForm(CPDF_Document* pDocument, FX_BOOL bUpdateAP); |
| 591 void DisplayAnnots(const CPDF_Page* pPage, CP
DF_RenderContext* pContext, | 591 |
| 592 FX_BOOL bPrinting, CFX_AffineMatrix* pMatr
ix, FX_BOOL bShowWidget, | 592 ~CPDF_InterForm(); |
| 593 CPDF_RenderOptions* pOptions) | 593 |
| 594 { | 594 static void EnableUpdateAP(FX_BOOL bUpdateAP); |
| 595 DisplayAnnots(pPage, NULL, pContext, bPrinting, pMatrix, bShowWidget ? 3
: 1, pOptions, NULL); | 595 |
| 596 } | 596 static FX_BOOL UpdatingAPEnabled(); |
| 597 | 597 |
| 598 void DisplayAnnots(const CPDF_Page* pPage, CP
DF_RenderContext* pContext, | 598 static CFX_ByteString GenerateNewResourceName(const CPDF_Dictionary* pResDict, |
| 599 FX_BOOL bPrinting, CFX_AffineMatrix* pMatr
ix, FX_BOOL bShowWidget, | 599 const FX_CHAR* csType, |
| 600 CPDF_RenderOptions* pOptions, FX_RECT *pCl
ipRect) | 600 int iMinLen = 2, |
| 601 { | 601 const FX_CHAR* csPrefix = ""); |
| 602 DisplayAnnots(pPage, NULL, pContext, bPrinting, pMatrix, bShowWidget ? 3
: 1, pOptions, pClipRect); | 602 |
| 603 } | 603 static CPDF_Font* AddSystemDefaultFont(const CPDF_Document* pDocument); |
| 604 | 604 |
| 605 void DisplayAnnots(const CPDF_Page* pPage, CF
X_RenderDevice* pDevice, CPDF_RenderContext* pContext, | 605 static CPDF_Font* AddSystemFont(const CPDF_Document* pDocument, |
| 606 FX_BOOL bPrinting, CFX_AffineMatrix* pMatr
ix, FX_DWORD dwAnnotFlags, | 606 CFX_ByteString csFontName, |
| 607 CPDF_RenderOptions* pOptions, FX_RECT* pCl
ipRect); | 607 uint8_t iCharSet = 1); |
| 608 | 608 |
| 609 | 609 static CPDF_Font* AddSystemFont(const CPDF_Document* pDocument, |
| 610 | 610 CFX_WideString csFontName, |
| 611 CPDF_Annot* GetAt(int index) | 611 uint8_t iCharSet = 1); |
| 612 { | 612 |
| 613 return (CPDF_Annot*)m_AnnotList.GetAt(index); | 613 static CPDF_Font* AddStandardFont(const CPDF_Document* pDocument, |
| 614 } | 614 CFX_ByteString csFontName); |
| 615 | 615 |
| 616 int Count() | 616 static CFX_ByteString GetNativeFont(uint8_t iCharSet, void* pLogFont = NULL); |
| 617 { | 617 |
| 618 return m_AnnotList.GetSize(); | 618 static CFX_ByteString GetNativeFont(void* pLogFont = NULL); |
| 619 } | 619 |
| 620 | 620 static uint8_t GetNativeCharSet(); |
| 621 int GetIndex(CPDF_Annot* pAnnot); | 621 |
| 622 | 622 static CPDF_Font* AddNativeFont(uint8_t iCharSet, |
| 623 | 623 const CPDF_Document* pDocument); |
| 624 CPDF_Document* GetDocument() const | 624 |
| 625 { | 625 static CPDF_Font* AddNativeFont(const CPDF_Document* pDocument); |
| 626 return m_pDocument; | 626 |
| 627 } | 627 FX_BOOL ValidateFieldName(CFX_WideString& csNewFieldName, int iType); |
| 628 protected: | 628 |
| 629 | 629 FX_BOOL ValidateFieldName(const CPDF_FormField* pField, |
| 630 CFX_PtrArray m_AnnotList; | 630 CFX_WideString& csNewFieldName); |
| 631 | 631 |
| 632 CPDF_Dictionary* m_pPageDict; | 632 FX_BOOL ValidateFieldName(const CPDF_FormControl* pControl, |
| 633 | 633 CFX_WideString& csNewFieldName); |
| 634 CPDF_Document* m_pDocument; | 634 |
| 635 | 635 FX_DWORD CountFields(const CFX_WideString& csFieldName = L""); |
| 636 CFX_PtrArray m_Borders; | 636 |
| 637 | 637 CPDF_FormField* GetField(FX_DWORD index, |
| 638 void DisplayPass(const CPDF_Page* pPage, CFX_
RenderDevice* pDevice, | 638 const CFX_WideString& csFieldName = L""); |
| 639 CPDF_RenderContext* pContext, FX_BOOL bPrint
ing, CFX_AffineMatrix* pMatrix, | 639 |
| 640 FX_BOOL bWidget, CPDF_RenderOptions* pOption
s, FX_RECT* clip_rect); | 640 void GetAllFieldNames(CFX_WideStringArray& allFieldNames); |
| 641 friend class CPDF_Annot; | 641 |
| 642 }; | 642 FX_BOOL IsValidFormField(const void* pField); |
| 643 #define COLORTYPE_TRANSPARENT 0 | 643 |
| 644 #define COLORTYPE_GRAY 1 | 644 CPDF_FormField* GetFieldByDict(CPDF_Dictionary* pFieldDict) const; |
| 645 #define COLORTYPE_RGB 2 | 645 |
| 646 #define COLORTYPE_CMYK 3 | 646 FX_DWORD CountControls(CFX_WideString csFieldName = L""); |
| 647 class CPDF_DefaultAppearance | 647 |
| 648 { | 648 CPDF_FormControl* GetControl(FX_DWORD index, |
| 649 public: | 649 CFX_WideString csFieldName = L""); |
| 650 | 650 |
| 651 CPDF_DefaultAppearance(const CFX_ByteString& csDA = "") | 651 FX_BOOL IsValidFormControl(const void* pControl); |
| 652 { | 652 |
| 653 m_csDA = csDA; | 653 int CountPageControls(CPDF_Page* pPage) const; |
| 654 } | 654 |
| 655 | 655 CPDF_FormControl* GetPageControl(CPDF_Page* pPage, int index) const; |
| 656 CPDF_DefaultAppearance(const CPDF_DefaultAppearance& cDA) | 656 |
| 657 { | 657 CPDF_FormControl* GetControlAtPoint(CPDF_Page* pPage, |
| 658 m_csDA = (CFX_ByteString)(CPDF_DefaultAppearance&)cDA; | 658 FX_FLOAT pdf_x, |
| 659 } | 659 FX_FLOAT pdf_y) const; |
| 660 | 660 |
| 661 | 661 CPDF_FormControl* GetControlByDict(CPDF_Dictionary* pWidgetDict) const; |
| 662 operator CFX_ByteString() const | 662 |
| 663 { | 663 FX_DWORD CountInternalFields(const CFX_WideString& csFieldName = L"") const; |
| 664 return m_csDA; | 664 |
| 665 } | 665 CPDF_Dictionary* GetInternalField( |
| 666 | 666 FX_DWORD index, |
| 667 const CPDF_DefaultAppearance& operator =(const CFX_ByteString& csDA) | 667 const CFX_WideString& csFieldName = L"") const; |
| 668 { | 668 |
| 669 m_csDA = csDA; | 669 CPDF_Document* GetDocument() const { return m_pDocument; } |
| 670 return *this; | 670 |
| 671 } | 671 CPDF_Dictionary* GetFormDict() const { return m_pFormDict; } |
| 672 | 672 |
| 673 const CPDF_DefaultAppearance& operator =(const CPDF_DefaultAppearance& cDA) | 673 FX_BOOL NeedConstructAP(); |
| 674 { | 674 |
| 675 m_csDA = (CFX_ByteString)(CPDF_DefaultAppearance&)cDA; | 675 void NeedConstructAP(FX_BOOL bNeedAP); |
| 676 return *this; | 676 |
| 677 } | 677 int CountFieldsInCalculationOrder(); |
| 678 | 678 |
| 679 | 679 CPDF_FormField* GetFieldInCalculationOrder(int index); |
| 680 | 680 |
| 681 FX_BOOL HasFont(); | 681 int FindFieldInCalculationOrder(const CPDF_FormField* pField); |
| 682 | 682 |
| 683 CFX_ByteString GetFontString(); | 683 FX_DWORD CountFormFonts(); |
| 684 | 684 |
| 685 void GetFont(CFX_ByteString& csFontNameTag, F
X_FLOAT& fFontSize); | 685 CPDF_Font* GetFormFont(FX_DWORD index, CFX_ByteString& csNameTag); |
| 686 | 686 |
| 687 | 687 CPDF_Font* GetFormFont(CFX_ByteString csNameTag); |
| 688 | 688 |
| 689 | 689 CPDF_Font* GetFormFont(CFX_ByteString csFontName, CFX_ByteString& csNameTag); |
| 690 FX_BOOL HasColor(FX_BOOL bStrokingOperation = FA
LSE); | 690 |
| 691 | 691 CPDF_Font* GetNativeFormFont(uint8_t iCharSet, CFX_ByteString& csNameTag); |
| 692 CFX_ByteString GetColorString(FX_BOOL bStrokingOperation = FALS
E); | 692 |
| 693 | 693 CPDF_Font* GetNativeFormFont(CFX_ByteString& csNameTag); |
| 694 void GetColor(int& iColorType, FX_FLOAT fc[4]
, FX_BOOL bStrokingOperation = FALSE); | 694 |
| 695 | 695 FX_BOOL FindFormFont(const CPDF_Font* pFont, CFX_ByteString& csNameTag); |
| 696 void GetColor(FX_ARGB& color, int& iColorType
, FX_BOOL bStrokingOperation = FALSE); | 696 |
| 697 | 697 FX_BOOL FindFormFont(CFX_ByteString csFontName, |
| 698 | 698 CPDF_Font*& pFont, |
| 699 | 699 CFX_ByteString& csNameTag); |
| 700 | 700 |
| 701 FX_BOOL HasTextMatrix(); | 701 inline FX_BOOL FindFormFont(CFX_WideString csFontName, |
| 702 | 702 CPDF_Font*& pFont, |
| 703 CFX_ByteString GetTextMatrixString(); | 703 CFX_ByteString& csNameTag) { |
| 704 | 704 return FindFormFont(PDF_EncodeText(csFontName), pFont, csNameTag); |
| 705 CFX_AffineMatrix GetTextMatrix(); | 705 } |
| 706 | 706 |
| 707 protected: | 707 void AddFormFont(const CPDF_Font* pFont, CFX_ByteString& csNameTag); |
| 708 | 708 |
| 709 CFX_ByteString m_csDA; | 709 CPDF_Font* AddNativeFormFont(uint8_t iCharSet, CFX_ByteString& csNameTag); |
| 710 }; | 710 |
| 711 #define FIELDTYPE_UNKNOWN 0 | 711 CPDF_Font* AddNativeFormFont(CFX_ByteString& csNameTag); |
| 712 #define FIELDTYPE_PUSHBUTTON 1 | 712 |
| 713 #define FIELDTYPE_CHECKBOX 2 | 713 void RemoveFormFont(const CPDF_Font* pFont); |
| 714 #define FIELDTYPE_RADIOBUTTON 3 | 714 |
| 715 #define FIELDTYPE_COMBOBOX 4 | 715 void RemoveFormFont(CFX_ByteString csNameTag); |
| 716 #define FIELDTYPE_LISTBOX 5 | 716 |
| 717 #define FIELDTYPE_TEXTFIELD 6 | 717 CPDF_DefaultAppearance GetDefaultAppearance(); |
| 718 #define FIELDTYPE_SIGNATURE 7 | 718 |
| 719 class CPDF_InterForm : public CFX_PrivateData | 719 CPDF_Font* GetDefaultFormFont(); |
| 720 { | 720 |
| 721 public: | 721 int GetFormAlignment(); |
| 722 | 722 |
| 723 CPDF_InterForm(CPDF_Document* pDocument, FX_BOOL bUpdateAP); | 723 CPDF_FormField* CheckRequiredFields(const CFX_PtrArray* fields = NULL, |
| 724 | 724 FX_BOOL bIncludeOrExclude = TRUE) const; |
| 725 ~CPDF_InterForm(); | 725 |
| 726 | 726 CFDF_Document* ExportToFDF(const CFX_WideStringC& pdf_path, |
| 727 | 727 FX_BOOL bSimpleFileSpec = FALSE) const; |
| 728 | 728 |
| 729 static void EnableUpdateAP(FX_BOOL bUpdateAP); | 729 CFDF_Document* ExportToFDF(const CFX_WideStringC& pdf_path, |
| 730 | 730 CFX_PtrArray& fields, |
| 731 static FX_BOOL UpdatingAPEnabled(); | 731 FX_BOOL bIncludeOrExclude = TRUE, |
| 732 | 732 FX_BOOL bSimpleFileSpec = FALSE) const; |
| 733 | 733 |
| 734 static CFX_ByteString GenerateNewResourceName(const CPDF_Dictionary* p
ResDict, const FX_CHAR* csType, int iMinLen = 2, const FX_CHAR* csPrefix = ""); | 734 FX_BOOL ImportFromFDF(const CFDF_Document* pFDFDoc, FX_BOOL bNotify = FALSE); |
| 735 | 735 |
| 736 | 736 FX_BOOL ResetForm(const CFX_PtrArray& fields, |
| 737 | 737 FX_BOOL bIncludeOrExclude = TRUE, |
| 738 static CPDF_Font* AddSystemDefaultFont(const CPDF_Document* pDocum
ent); | 738 FX_BOOL bNotify = FALSE); |
| 739 | 739 |
| 740 static CPDF_Font* AddSystemFont(const CPDF_Document* pDocument, CF
X_ByteString csFontName, uint8_t iCharSet = 1); | 740 FX_BOOL ResetForm(FX_BOOL bNotify = FALSE); |
| 741 | 741 |
| 742 static CPDF_Font* AddSystemFont(const CPDF_Document* pDocument, CF
X_WideString csFontName, uint8_t iCharSet = 1); | 742 void ReloadForm(); |
| 743 | 743 |
| 744 static CPDF_Font* AddStandardFont(const CPDF_Document* pDocument,
CFX_ByteString csFontName); | 744 CPDF_FormNotify* GetFormNotify() const { return m_pFormNotify; } |
| 745 | 745 |
| 746 static CFX_ByteString GetNativeFont(uint8_t iCharSet, void* pLogFont =
NULL); | 746 void SetFormNotify(const CPDF_FormNotify* pNotify); |
| 747 | 747 |
| 748 static CFX_ByteString GetNativeFont(void* pLogFont = NULL); | 748 int GetPageWithWidget(int iCurPage, FX_BOOL bNext); |
| 749 | 749 |
| 750 static uint8_t GetNativeCharSet(); | 750 FX_BOOL IsUpdated() { return m_bUpdated; } |
| 751 | 751 |
| 752 static CPDF_Font* AddNativeFont(uint8_t iCharSet, const CPDF_Docum
ent* pDocument); | 752 void ClearUpdatedFlag() { m_bUpdated = FALSE; } |
| 753 | 753 |
| 754 static CPDF_Font* AddNativeFont(const CPDF_Document* pDocument); | 754 FX_BOOL HasXFAForm() const; |
| 755 | 755 |
| 756 | 756 void FixPageFields(const CPDF_Page* pPage); |
| 757 | 757 |
| 758 | 758 protected: |
| 759 FX_BOOL ValidateFieldName(CFX_WideString
& csNewFieldName, int iType); | 759 static FX_BOOL m_bUpdateAP; |
| 760 | 760 |
| 761 FX_BOOL ValidateFieldName(const CPDF_For
mField* pField, CFX_WideString& csNewFieldName); | 761 void LoadField(CPDF_Dictionary* pFieldDict, int nLevel = 0); |
| 762 | 762 |
| 763 FX_BOOL ValidateFieldName(const CPDF_For
mControl* pControl, CFX_WideString& csNewFieldName); | 763 CPDF_Object* GetFieldAttr(CPDF_Dictionary* pFieldDict, const FX_CHAR* name); |
| 764 | 764 |
| 765 | 765 CPDF_FormField* AddTerminalField(const CPDF_Dictionary* pFieldDict); |
| 766 | 766 |
| 767 | 767 CPDF_FormControl* AddControl(const CPDF_FormField* pField, |
| 768 FX_DWORD CountFields(const CFX_WideString &csFiel
dName = L""); | 768 const CPDF_Dictionary* pWidgetDict); |
| 769 | 769 |
| 770 CPDF_FormField* GetField(FX_DWORD index, const CFX_WideS
tring &csFieldName = L""); | 770 void FDF_ImportField(CPDF_Dictionary* pField, |
| 771 | 771 const CFX_WideString& parent_name, |
| 772 void GetAllFieldNames(CFX_WideStringA
rray& allFieldNames); | 772 FX_BOOL bNotify = FALSE, |
| 773 | 773 int nLevel = 0); |
| 774 FX_BOOL IsValidFormField(const void* pFi
eld); | 774 |
| 775 | 775 FX_BOOL ValidateFieldName(CFX_WideString& csNewFieldName, |
| 776 CPDF_FormField* GetFieldByDict(CPDF_Dictionary* pFieldDi
ct) const; | 776 int iType, |
| 777 | 777 const CPDF_FormField* pExcludedField, |
| 778 | 778 const CPDF_FormControl* pExcludedControl); |
| 779 | 779 |
| 780 | 780 int CompareFieldName(const CFX_WideString& name1, |
| 781 FX_DWORD CountControls(CFX_WideString csFieldName
= L""); | 781 const CFX_WideString& name2); |
| 782 | 782 |
| 783 CPDF_FormControl* GetControl(FX_DWORD index, CFX_WideString csFiel
dName = L""); | 783 int CompareFieldName(const CFX_ByteString& name1, |
| 784 | 784 const CFX_ByteString& name2); |
| 785 FX_BOOL IsValidFormControl(const void* p
Control); | 785 |
| 786 | 786 CPDF_Document* m_pDocument; |
| 787 int CountPageControls(CPDF_Page* pPa
ge) const; | 787 |
| 788 | 788 FX_BOOL m_bGenerateAP; |
| 789 CPDF_FormControl* GetPageControl(CPDF_Page* pPage, int index) cons
t; | 789 |
| 790 | 790 CPDF_Dictionary* m_pFormDict; |
| 791 | 791 |
| 792 CPDF_FormControl* GetControlAtPoint(CPDF_Page* pPage, FX_FLOAT pdf
_x, FX_FLOAT pdf_y) const; | 792 CFX_MapPtrToPtr m_ControlMap; |
| 793 | 793 |
| 794 CPDF_FormControl* GetControlByDict(CPDF_Dictionary* pWidgetDict) c
onst; | 794 CFieldTree* m_pFieldTree; |
| 795 | 795 |
| 796 | 796 CFX_ByteString m_bsEncoding; |
| 797 | 797 |
| 798 | 798 CPDF_FormNotify* m_pFormNotify; |
| 799 FX_DWORD CountInternalFields(const CFX_WideString
& csFieldName = L"") const; | 799 |
| 800 | 800 FX_BOOL m_bUpdated; |
| 801 CPDF_Dictionary* GetInternalField(FX_DWORD index, const CFX_WideS
tring& csFieldName = L"") const; | 801 friend class CPDF_FormControl; |
| 802 | 802 friend class CPDF_FormField; |
| 803 | 803 }; |
| 804 | 804 #define FORMFIELD_READONLY 0x01 |
| 805 | 805 #define FORMFIELD_REQUIRED 0x02 |
| 806 | 806 #define FORMFIELD_NOEXPORT 0x04 |
| 807 CPDF_Document* GetDocument() const | 807 #define FORMRADIO_NOTOGGLEOFF 0x100 |
| 808 { | 808 #define FORMRADIO_UNISON 0x200 |
| 809 return m_pDocument; | 809 #define FORMTEXT_MULTILINE 0x100 |
| 810 } | 810 #define FORMTEXT_PASSWORD 0x200 |
| 811 | 811 #define FORMTEXT_NOSCROLL 0x400 |
| 812 CPDF_Dictionary* GetFormDict() const | 812 #define FORMTEXT_COMB 0x800 |
| 813 { | 813 #define FORMCOMBO_EDIT 0x100 |
| 814 return m_pFormDict; | 814 #define FORMLIST_MULTISELECT 0x100 |
| 815 } | 815 class CPDF_FormField { |
| 816 | 816 public: |
| 817 | 817 enum Type { |
| 818 | 818 Unknown, |
| 819 | 819 PushButton, |
| 820 FX_BOOL NeedConstructAP(); | 820 RadioButton, |
| 821 | 821 CheckBox, |
| 822 void NeedConstructAP(FX_BOOL bNeedAP)
; | 822 Text, |
| 823 | 823 RichText, |
| 824 | 824 File, |
| 825 | 825 ListBox, |
| 826 | 826 ComboBox, |
| 827 int CountFieldsInCalculationOrder(); | 827 Sign |
| 828 | 828 }; |
| 829 CPDF_FormField* GetFieldInCalculationOrder(int index); | 829 |
| 830 | 830 CFX_WideString GetFullName(); |
| 831 int FindFieldInCalculationOrder(cons
t CPDF_FormField* pField); | 831 |
| 832 | 832 Type GetType() { return m_Type; } |
| 833 | 833 |
| 834 | 834 FX_DWORD GetFlags() { return m_Flags; } |
| 835 | 835 |
| 836 FX_DWORD CountFormFonts(); | 836 CPDF_InterForm* GetInterForm() const { return m_pForm; } |
| 837 | 837 |
| 838 CPDF_Font* GetFormFont(FX_DWORD index, CFX_ByteStri
ng& csNameTag); | 838 CPDF_Dictionary* GetFieldDict() const { return m_pDict; } |
| 839 | 839 |
| 840 CPDF_Font* GetFormFont(CFX_ByteString csNameTag); | 840 void SetFieldDict(CPDF_Dictionary* pDict) { m_pDict = pDict; } |
| 841 | 841 |
| 842 CPDF_Font* GetFormFont(CFX_ByteString csFontName, C
FX_ByteString& csNameTag); | 842 FX_BOOL ResetField(FX_BOOL bNotify = FALSE); |
| 843 | 843 |
| 844 CPDF_Font* GetNativeFormFont(uint8_t iCharSet, CFX_
ByteString& csNameTag); | 844 int CountControls() { return m_ControlList.GetSize(); } |
| 845 | 845 |
| 846 CPDF_Font* GetNativeFormFont(CFX_ByteString& csName
Tag); | 846 CPDF_FormControl* GetControl(int index) { |
| 847 | 847 return (CPDF_FormControl*)m_ControlList.GetAt(index); |
| 848 FX_BOOL FindFormFont(const CPDF_Font* pF
ont, CFX_ByteString& csNameTag); | 848 } |
| 849 | 849 |
| 850 FX_BOOL FindFormFont(CFX_ByteString csFo
ntName, CPDF_Font*& pFont, CFX_ByteString& csNameTag); | 850 int GetControlIndex(const CPDF_FormControl* pControl); |
| 851 | 851 |
| 852 inline FX_BOOL FindFormFont(CFX_WideString csFontName,
CPDF_Font*& pFont, CFX_ByteString& csNameTag) | 852 int GetFieldType(); |
| 853 { | 853 |
| 854 return FindFormFont(PDF_EncodeText(csFontName), pFont, csNameTag); | 854 CPDF_AAction GetAdditionalAction(); |
| 855 } | 855 |
| 856 | 856 CFX_WideString GetAlternateName(); |
| 857 | 857 |
| 858 | 858 CFX_WideString GetMappingName(); |
| 859 | 859 |
| 860 | 860 FX_DWORD GetFieldFlags(); |
| 861 void AddFormFont(const CPDF_Font* pFo
nt, CFX_ByteString& csNameTag); | 861 |
| 862 | 862 CFX_ByteString GetDefaultStyle(); |
| 863 CPDF_Font* AddNativeFormFont(uint8_t iCharSet, CFX_
ByteString& csNameTag); | 863 |
| 864 | 864 CFX_WideString GetRichTextString(); |
| 865 CPDF_Font* AddNativeFormFont(CFX_ByteString& csName
Tag); | 865 |
| 866 | 866 CFX_WideString GetValue(); |
| 867 void RemoveFormFont(const CPDF_Font*
pFont); | 867 |
| 868 | 868 CFX_WideString GetDefaultValue(); |
| 869 void RemoveFormFont(CFX_ByteString cs
NameTag); | 869 |
| 870 | 870 FX_BOOL SetValue(const CFX_WideString& value, FX_BOOL bNotify = FALSE); |
| 871 | 871 |
| 872 | 872 int GetMaxLen(); |
| 873 | 873 |
| 874 CPDF_DefaultAppearance GetDefaultAppearance(); | 874 int CountSelectedItems(); |
| 875 | 875 |
| 876 CPDF_Font* GetDefaultFormFont(); | 876 int GetSelectedIndex(int index); |
| 877 | 877 |
| 878 | 878 FX_BOOL ClearSelection(FX_BOOL bNotify = FALSE); |
| 879 | 879 |
| 880 int GetFormAlignment(); | 880 FX_BOOL IsItemSelected(int index); |
| 881 | 881 |
| 882 | 882 FX_BOOL SetItemSelection(int index, |
| 883 | 883 FX_BOOL bSelected, |
| 884 | 884 FX_BOOL bNotify = FALSE); |
| 885 CPDF_FormField* CheckRequiredFields(const CFX_PtrArray *
fields = NULL, FX_BOOL bIncludeOrExclude = TRUE) const; | 885 |
| 886 | 886 FX_BOOL IsItemDefaultSelected(int index); |
| 887 CFDF_Document* ExportToFDF(const CFX_WideStringC& pdf_p
ath, FX_BOOL bSimpleFileSpec = FALSE) const; | 887 |
| 888 | 888 int GetDefaultSelectedItem(); |
| 889 CFDF_Document* ExportToFDF(const CFX_WideStringC& pdf_p
ath, CFX_PtrArray& fields, FX_BOOL bIncludeOrExclude = TRUE, FX_BOOL bSimpleFile
Spec = FALSE) const; | 889 |
| 890 | 890 int CountOptions(); |
| 891 FX_BOOL ImportFromFDF(const CFDF_Documen
t* pFDFDoc, FX_BOOL bNotify = FALSE); | 891 |
| 892 | 892 CFX_WideString GetOptionLabel(int index); |
| 893 | 893 |
| 894 | 894 CFX_WideString GetOptionValue(int index); |
| 895 | 895 |
| 896 FX_BOOL ResetForm(const CFX_PtrArray& fi
elds, FX_BOOL bIncludeOrExclude = TRUE, FX_BOOL bNotify = FALSE); | 896 int FindOption(CFX_WideString csOptLabel); |
| 897 | 897 |
| 898 FX_BOOL ResetForm(FX_BOOL bNotify = FALS
E); | 898 int FindOptionValue(const CFX_WideString& csOptValue, int iStartIndex = 0); |
| 899 | 899 |
| 900 void ReloadForm(); | 900 FX_BOOL CheckControl(int iControlIndex, |
| 901 | 901 FX_BOOL bChecked, |
| 902 CPDF_FormNotify* GetFormNotify() const | 902 FX_BOOL bNotify = FALSE); |
| 903 { | 903 |
| 904 return m_pFormNotify; | 904 int GetTopVisibleIndex(); |
| 905 } | 905 |
| 906 | 906 int CountSelectedOptions(); |
| 907 void SetFormNotify(const CPDF_FormNot
ify* pNotify); | 907 |
| 908 | 908 int GetSelectedOptionIndex(int index); |
| 909 | 909 |
| 910 int GetPageWithWidget(int iCurPage,
FX_BOOL bNext); | 910 FX_BOOL IsOptionSelected(int iOptIndex); |
| 911 | 911 |
| 912 | 912 FX_BOOL SelectOption(int iOptIndex, |
| 913 | 913 FX_BOOL bSelected, |
| 914 FX_BOOL IsUpdated() | 914 FX_BOOL bNotify = FALSE); |
| 915 { | 915 |
| 916 return m_bUpdated; | 916 FX_BOOL ClearSelectedOptions(FX_BOOL bNotify = FALSE); |
| 917 } | 917 |
| 918 | 918 FX_FLOAT GetFontSize() { return m_FontSize; } |
| 919 void ClearUpdatedFlag() | 919 |
| 920 { | 920 CPDF_Font* GetFont() { return m_pFont; } |
| 921 m_bUpdated = FALSE; | 921 |
| 922 } | 922 protected: |
| 923 | 923 CPDF_FormField(CPDF_InterForm* pForm, CPDF_Dictionary* pDict); |
| 924 | 924 |
| 925 FX_BOOL HasXFAForm() const; | 925 ~CPDF_FormField(); |
| 926 | 926 |
| 927 void FixPageFields(const CPDF_Page* p
Page); | 927 CPDF_FormField::Type m_Type; |
| 928 protected: | 928 |
| 929 | 929 FX_DWORD m_Flags; |
| 930 static FX_BOOL m_bUpdateAP; | 930 |
| 931 | 931 CPDF_InterForm* m_pForm; |
| 932 void LoadField(CPDF_Dictionary* pFiel
dDict, int nLevel = 0); | 932 |
| 933 | 933 CPDF_Dictionary* m_pDict; |
| 934 CPDF_Object* GetFieldAttr(CPDF_Dictionary* pFieldDict
, const FX_CHAR* name); | 934 |
| 935 | 935 CFX_PtrArray m_ControlList; |
| 936 CPDF_FormField* AddTerminalField(const CPDF_Dictionary*
pFieldDict); | 936 friend class CPDF_InterForm; |
| 937 | 937 friend class CPDF_FormControl; |
| 938 CPDF_FormControl* AddControl(const CPDF_FormField* pField, const C
PDF_Dictionary* pWidgetDict); | 938 |
| 939 | 939 CFX_WideString GetValue(FX_BOOL bDefault); |
| 940 void FDF_ImportField(CPDF_Dictionary*
pField, const CFX_WideString& parent_name, FX_BOOL bNotify = FALSE, int nLevel
= 0); | 940 |
| 941 | 941 FX_BOOL SetValue(const CFX_WideString& value, |
| 942 FX_BOOL ValidateFieldName(CFX_WideString
& csNewFieldName, int iType, const CPDF_FormField* pExcludedField, const CPDF_Fo
rmControl* pExcludedControl); | 942 FX_BOOL bDefault, |
| 943 | 943 FX_BOOL bNotify); |
| 944 int CompareFieldName(const CFX_WideS
tring& name1, const CFX_WideString& name2); | 944 |
| 945 | 945 void SyncFieldFlags(); |
| 946 int CompareFieldName(const CFX_ByteS
tring& name1, const CFX_ByteString& name2); | 946 |
| 947 | 947 int FindListSel(CPDF_String* str); |
| 948 CPDF_Document* m_pDocument; | 948 |
| 949 | 949 CFX_WideString GetOptionText(int index, int sub_index); |
| 950 FX_BOOL m_bGenerateAP; | 950 |
| 951 | 951 void LoadDA(); |
| 952 CPDF_Dictionary* m_pFormDict; | 952 |
| 953 | 953 void UpdateAP(CPDF_FormControl* pControl); |
| 954 CFX_MapPtrToPtr m_ControlMap; | 954 |
| 955 | 955 CFX_WideString GetCheckValue(FX_BOOL bDefault); |
| 956 CFieldTree *m_pFieldTree; | 956 |
| 957 | 957 FX_BOOL SetCheckValue(const CFX_WideString& value, |
| 958 CFX_ByteString m_bsEncoding; | 958 FX_BOOL bDefault, |
| 959 | 959 FX_BOOL bNotify); |
| 960 CPDF_FormNotify* m_pFormNotify; | 960 |
| 961 | 961 FX_FLOAT m_FontSize; |
| 962 FX_BOOL m_bUpdated; | 962 |
| 963 friend class CPDF_FormControl; | 963 CPDF_Font* m_pFont; |
| 964 friend class CPDF_FormField; | 964 }; |
| 965 }; | 965 CPDF_Object* FPDF_GetFieldAttr(CPDF_Dictionary* pFieldDict, |
| 966 #define FORMFIELD_READONLY 0x01 | 966 const FX_CHAR* name, |
| 967 #define FORMFIELD_REQUIRED 0x02 | 967 int nLevel = 0); |
| 968 #define FORMFIELD_NOEXPORT 0x04 | 968 class CPDF_IconFit { |
| 969 #define FORMRADIO_NOTOGGLEOFF 0x100 | 969 public: |
| 970 #define FORMRADIO_UNISON 0x200 | 970 CPDF_IconFit(CPDF_Dictionary* pDict = NULL) { m_pDict = pDict; } |
| 971 #define FORMTEXT_MULTILINE 0x100 | 971 |
| 972 #define FORMTEXT_PASSWORD 0x200 | 972 operator CPDF_Dictionary*() const { return m_pDict; } |
| 973 #define FORMTEXT_NOSCROLL 0x400 | 973 |
| 974 #define FORMTEXT_COMB 0x800 | 974 enum ScaleMethod { Always = 0, Bigger, Smaller, Never }; |
| 975 #define FORMCOMBO_EDIT 0x100 | 975 |
| 976 #define FORMLIST_MULTISELECT 0x100 | 976 ScaleMethod GetScaleMethod(); |
| 977 class CPDF_FormField | 977 |
| 978 { | 978 FX_BOOL IsProportionalScale(); |
| 979 public: | 979 |
| 980 | 980 void GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom); |
| 981 enum Type { | 981 |
| 982 Unknown, | 982 FX_BOOL GetFittingBounds(); |
| 983 PushButton, | 983 |
| 984 RadioButton, | 984 CPDF_Dictionary* m_pDict; |
| 985 CheckBox, | 985 }; |
| 986 Text, | 986 |
| 987 RichText, | 987 #define TEXTPOS_CAPTION 0 |
| 988 File, | 988 #define TEXTPOS_ICON 1 |
| 989 ListBox, | 989 #define TEXTPOS_BELOW 2 |
| 990 ComboBox, | 990 #define TEXTPOS_ABOVE 3 |
| 991 Sign | 991 #define TEXTPOS_RIGHT 4 |
| 992 }; | 992 #define TEXTPOS_LEFT 5 |
| 993 | 993 #define TEXTPOS_OVERLAID 6 |
| 994 CFX_WideString GetFullName(); | 994 class CPDF_FormControl { |
| 995 | 995 public: |
| 996 Type GetType() | 996 CPDF_FormField::Type GetType() { return m_pField->GetType(); } |
| 997 { | 997 |
| 998 return m_Type; | 998 CPDF_InterForm* GetInterForm() const { return m_pForm; } |
| 999 } | 999 |
| 1000 | 1000 CPDF_FormField* GetField() const { return m_pField; } |
| 1001 FX_DWORD GetFlags() | 1001 |
| 1002 { | 1002 CPDF_Dictionary* GetWidget() const { return m_pWidgetDict; } |
| 1003 return m_Flags; | 1003 |
| 1004 } | 1004 CFX_FloatRect GetRect(); |
| 1005 | 1005 |
| 1006 CPDF_InterForm* GetInterForm() const | 1006 void DrawControl(CFX_RenderDevice* pDevice, |
| 1007 { | 1007 CFX_AffineMatrix* pMatrix, |
| 1008 return m_pForm; | 1008 CPDF_Page* pPage, |
| 1009 } | 1009 CPDF_Annot::AppearanceMode mode, |
| 1010 | 1010 const CPDF_RenderOptions* pOptions = NULL); |
| 1011 CPDF_Dictionary* GetFieldDict() const | 1011 |
| 1012 { | 1012 CFX_ByteString GetCheckedAPState(); |
| 1013 return m_pDict; | 1013 |
| 1014 } | 1014 CFX_WideString GetExportValue(); |
| 1015 | 1015 |
| 1016 void SetFieldDict(CPDF_Dictionary* pD
ict) | 1016 FX_BOOL IsChecked(); |
| 1017 { | 1017 |
| 1018 m_pDict = pDict; | 1018 FX_BOOL IsDefaultChecked(); |
| 1019 } | 1019 |
| 1020 | 1020 enum HighlightingMode { None = 0, Invert, Outline, Push, Toggle }; |
| 1021 FX_BOOL ResetField(FX_BOOL bNotify = FAL
SE); | 1021 |
| 1022 | 1022 HighlightingMode GetHighlightingMode(); |
| 1023 | 1023 |
| 1024 | 1024 FX_BOOL HasMKEntry(CFX_ByteString csEntry); |
| 1025 int CountControls() | 1025 |
| 1026 { | 1026 int GetRotation(); |
| 1027 return m_ControlList.GetSize(); | 1027 |
| 1028 } | 1028 inline FX_ARGB GetBorderColor(int& iColorType) { |
| 1029 | 1029 return GetColor(iColorType, "BC"); |
| 1030 CPDF_FormControl* GetControl(int index) | 1030 } |
| 1031 { | 1031 |
| 1032 return (CPDF_FormControl*)m_ControlList.GetAt(index); | 1032 inline FX_FLOAT GetOriginalBorderColor(int index) { |
| 1033 } | 1033 return GetOriginalColor(index, "BC"); |
| 1034 | 1034 } |
| 1035 int GetControlIndex(const CPDF_FormC
ontrol* pControl); | 1035 |
| 1036 | 1036 inline void GetOriginalBorderColor(int& iColorType, FX_FLOAT fc[4]) { |
| 1037 | 1037 GetOriginalColor(iColorType, fc, "BC"); |
| 1038 | 1038 } |
| 1039 | 1039 |
| 1040 int GetFieldType(); | 1040 inline FX_ARGB GetBackgroundColor(int& iColorType) { |
| 1041 | 1041 return GetColor(iColorType, "BG"); |
| 1042 | 1042 } |
| 1043 | 1043 |
| 1044 | 1044 inline FX_FLOAT GetOriginalBackgroundColor(int index) { |
| 1045 CPDF_AAction GetAdditionalAction(); | 1045 return GetOriginalColor(index, "BG"); |
| 1046 | 1046 } |
| 1047 | 1047 |
| 1048 | 1048 inline void GetOriginalBackgroundColor(int& iColorType, FX_FLOAT fc[4]) { |
| 1049 | 1049 GetOriginalColor(iColorType, fc, "BG"); |
| 1050 CFX_WideString GetAlternateName(); | 1050 } |
| 1051 | 1051 |
| 1052 | 1052 inline CFX_WideString GetNormalCaption() { return GetCaption("CA"); } |
| 1053 | 1053 |
| 1054 | 1054 inline CFX_WideString GetRolloverCaption() { return GetCaption("RC"); } |
| 1055 CFX_WideString GetMappingName(); | 1055 |
| 1056 | 1056 inline CFX_WideString GetDownCaption() { return GetCaption("AC"); } |
| 1057 | 1057 |
| 1058 | 1058 inline CPDF_Stream* GetNormalIcon() { return GetIcon("I"); } |
| 1059 | 1059 |
| 1060 FX_DWORD GetFieldFlags(); | 1060 inline CPDF_Stream* GetRolloverIcon() { return GetIcon("RI"); } |
| 1061 | 1061 |
| 1062 | 1062 inline CPDF_Stream* GetDownIcon() { return GetIcon("IX"); } |
| 1063 | 1063 |
| 1064 | 1064 CPDF_IconFit GetIconFit(); |
| 1065 CFX_ByteString GetDefaultStyle(); | 1065 |
| 1066 | 1066 int GetTextPosition(); |
| 1067 | 1067 |
| 1068 | 1068 CPDF_Action GetAction(); |
| 1069 | 1069 |
| 1070 CFX_WideString GetRichTextString(); | 1070 CPDF_AAction GetAdditionalAction(); |
| 1071 | 1071 |
| 1072 | 1072 CPDF_DefaultAppearance GetDefaultAppearance(); |
| 1073 | 1073 |
| 1074 CFX_WideString GetValue(); | 1074 CPDF_Font* GetDefaultControlFont(); |
| 1075 | 1075 |
| 1076 CFX_WideString GetDefaultValue(); | 1076 int GetControlAlignment(); |
| 1077 | 1077 |
| 1078 FX_BOOL SetValue(const CFX_WideString& v
alue, FX_BOOL bNotify = FALSE); | 1078 protected: |
| 1079 | 1079 CPDF_FormControl(CPDF_FormField* pField, CPDF_Dictionary* pWidgetDict); |
| 1080 | 1080 |
| 1081 | 1081 CFX_ByteString GetOnStateName(); |
| 1082 | 1082 |
| 1083 | 1083 void SetOnStateName(const CFX_ByteString& csOn); |
| 1084 int GetMaxLen(); | 1084 |
| 1085 | 1085 void CheckControl(FX_BOOL bChecked); |
| 1086 | 1086 |
| 1087 | 1087 FX_ARGB GetColor(int& iColorType, CFX_ByteString csEntry); |
| 1088 | 1088 |
| 1089 int CountSelectedItems(); | 1089 FX_FLOAT GetOriginalColor(int index, CFX_ByteString csEntry); |
| 1090 | 1090 |
| 1091 int GetSelectedIndex(int index); | 1091 void GetOriginalColor(int& iColorType, |
| 1092 | 1092 FX_FLOAT fc[4], |
| 1093 FX_BOOL ClearSelection(FX_BOOL bNotify =
FALSE); | 1093 CFX_ByteString csEntry); |
| 1094 | 1094 |
| 1095 FX_BOOL IsItemSelected(int index); | 1095 CFX_WideString GetCaption(CFX_ByteString csEntry); |
| 1096 | 1096 |
| 1097 FX_BOOL SetItemSelection(int index, FX_B
OOL bSelected, FX_BOOL bNotify = FALSE); | 1097 CPDF_Stream* GetIcon(CFX_ByteString csEntry); |
| 1098 | 1098 |
| 1099 FX_BOOL IsItemDefaultSelected(int index)
; | 1099 CPDF_ApSettings GetMK(FX_BOOL bCreate); |
| 1100 | 1100 |
| 1101 int GetDefaultSelectedItem(); | 1101 CPDF_InterForm* m_pForm; |
| 1102 | 1102 |
| 1103 | 1103 CPDF_FormField* m_pField; |
| 1104 | 1104 |
| 1105 | 1105 CPDF_Dictionary* m_pWidgetDict; |
| 1106 int CountOptions(); | 1106 friend class CPDF_InterForm; |
| 1107 | 1107 friend class CPDF_FormField; |
| 1108 CFX_WideString GetOptionLabel(int index); | 1108 }; |
| 1109 | 1109 class CPDF_FormNotify { |
| 1110 CFX_WideString GetOptionValue(int index); | 1110 public: |
| 1111 | 1111 virtual ~CPDF_FormNotify() {} |
| 1112 int FindOption(CFX_WideString csOptL
abel); | 1112 |
| 1113 | 1113 virtual int BeforeValueChange(const CPDF_FormField* pField, |
| 1114 int FindOptionValue(const CFX_WideSt
ring& csOptValue, int iStartIndex = 0); | 1114 CFX_WideString& csValue) { |
| 1115 | 1115 return 0; |
| 1116 | 1116 } |
| 1117 | 1117 |
| 1118 | 1118 virtual int AfterValueChange(const CPDF_FormField* pField) { return 0; } |
| 1119 FX_BOOL CheckControl(int iControlIndex,
FX_BOOL bChecked, FX_BOOL bNotify = FALSE); | 1119 |
| 1120 | 1120 virtual int BeforeSelectionChange(const CPDF_FormField* pField, |
| 1121 | 1121 CFX_WideString& csValue) { |
| 1122 | 1122 return 0; |
| 1123 | 1123 } |
| 1124 int GetTopVisibleIndex(); | 1124 |
| 1125 | 1125 virtual int AfterSelectionChange(const CPDF_FormField* pField) { return 0; } |
| 1126 | 1126 |
| 1127 | 1127 virtual int AfterCheckedStatusChange(const CPDF_FormField* pField, |
| 1128 | 1128 const CFX_ByteArray& statusArray) { |
| 1129 int CountSelectedOptions(); | 1129 return 0; |
| 1130 | 1130 } |
| 1131 int GetSelectedOptionIndex(int index
); | 1131 |
| 1132 | 1132 virtual int BeforeFormReset(const CPDF_InterForm* pForm) { return 0; } |
| 1133 FX_BOOL IsOptionSelected(int iOptIndex); | 1133 |
| 1134 | 1134 virtual int AfterFormReset(const CPDF_InterForm* pForm) { return 0; } |
| 1135 FX_BOOL SelectOption(int iOptIndex, FX_B
OOL bSelected, FX_BOOL bNotify = FALSE); | 1135 |
| 1136 | 1136 virtual int BeforeFormImportData(const CPDF_InterForm* pForm) { return 0; } |
| 1137 FX_BOOL ClearSelectedOptions(FX_BOOL bNo
tify = FALSE); | 1137 |
| 1138 | 1138 virtual int AfterFormImportData(const CPDF_InterForm* pForm) { return 0; } |
| 1139 | 1139 }; |
| 1140 | 1140 FX_BOOL FPDF_GenerateAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict); |
| 1141 | 1141 class CPDF_PageLabel { |
| 1142 FX_FLOAT GetFontSize() | 1142 public: |
| 1143 { | 1143 CPDF_PageLabel(CPDF_Document* pDocument) { m_pDocument = pDocument; } |
| 1144 return m_FontSize; | 1144 |
| 1145 } | 1145 CFX_WideString GetLabel(int nPage) const; |
| 1146 | 1146 |
| 1147 CPDF_Font* GetFont() | 1147 int32_t GetPageByLabel(const CFX_ByteStringC& bsLabel) const; |
| 1148 { | 1148 |
| 1149 return m_pFont; | 1149 int32_t GetPageByLabel(const CFX_WideStringC& wsLabel) const; |
| 1150 } | 1150 |
| 1151 | 1151 protected: |
| 1152 protected: | 1152 CPDF_Document* m_pDocument; |
| 1153 | 1153 }; |
| 1154 CPDF_FormField(CPDF_InterForm* pForm, CPDF_Dictionary* pDict); | 1154 class CPDF_Metadata { |
| 1155 | 1155 public: |
| 1156 ~CPDF_FormField(); | 1156 CPDF_Metadata(); |
| 1157 | 1157 |
| 1158 CPDF_FormField::Type m_Type; | 1158 ~CPDF_Metadata(); |
| 1159 | 1159 |
| 1160 FX_DWORD m_Flags; | 1160 void LoadDoc(CPDF_Document* pDoc); |
| 1161 | 1161 |
| 1162 CPDF_InterForm* m_pForm; | 1162 int32_t GetString(const CFX_ByteStringC& bsItem, CFX_WideString& wsStr); |
| 1163 | 1163 |
| 1164 CPDF_Dictionary* m_pDict; | 1164 CXML_Element* GetRoot() const; |
| 1165 | 1165 |
| 1166 CFX_PtrArray m_ControlList; | 1166 CXML_Element* GetRDF() const; |
| 1167 friend class CPDF_InterForm; | 1167 |
| 1168 friend class CPDF_FormControl; | 1168 protected: |
| 1169 | 1169 void* m_pData; |
| 1170 | 1170 }; |
| 1171 | 1171 class CPDF_ViewerPreferences { |
| 1172 CFX_WideString GetValue(FX_BOOL bDefault); | 1172 public: |
| 1173 | 1173 CPDF_ViewerPreferences(CPDF_Document* pDoc); |
| 1174 FX_BOOL SetValue(const CFX_WideString& v
alue, FX_BOOL bDefault, FX_BOOL bNotify); | 1174 |
| 1175 | 1175 ~CPDF_ViewerPreferences(); |
| 1176 | 1176 |
| 1177 void SyncFieldFlags(); | 1177 FX_BOOL IsDirectionR2L() const; |
| 1178 | 1178 |
| 1179 int FindListSel(CPDF_String* str); | 1179 FX_BOOL PrintScaling() const; |
| 1180 | 1180 |
| 1181 CFX_WideString GetOptionText(int index, int sub_index); | 1181 int32_t NumCopies() const; |
| 1182 | 1182 |
| 1183 void LoadDA(); | 1183 CPDF_Array* PrintPageRange() const; |
| 1184 | 1184 |
| 1185 void UpdateAP(CPDF_FormControl* pCont
rol); | 1185 CFX_ByteString Duplex() const; |
| 1186 | 1186 |
| 1187 | 1187 protected: |
| 1188 | 1188 CPDF_Document* m_pDoc; |
| 1189 CFX_WideString GetCheckValue(FX_BOOL bDefault); | 1189 }; |
| 1190 | 1190 class CPDF_ApSettings { |
| 1191 FX_BOOL SetCheckValue(const CFX_WideStri
ng& value, FX_BOOL bDefault, FX_BOOL bNotify); | 1191 public: |
| 1192 | 1192 CPDF_ApSettings(CPDF_Dictionary* pDict = NULL) { m_pDict = pDict; } |
| 1193 | 1193 |
| 1194 FX_FLOAT m_FontSize; | 1194 operator CPDF_Dictionary*() const { return m_pDict; } |
| 1195 | 1195 |
| 1196 CPDF_Font* m_pFont; | 1196 FX_BOOL HasMKEntry(const CFX_ByteStringC& csEntry); |
| 1197 }; | 1197 |
| 1198 CPDF_Object* FPDF_GetFieldAttr(CPDF_Dictionary* pFieldDict, const FX_CHAR* na
me, int nLevel = 0); | 1198 int GetRotation(); |
| 1199 class CPDF_IconFit | 1199 |
| 1200 { | 1200 inline FX_ARGB GetBorderColor(int& iColorType) { |
| 1201 public: | 1201 return GetColor(iColorType, FX_BSTRC("BC")); |
| 1202 | 1202 } |
| 1203 CPDF_IconFit(CPDF_Dictionary* pDict = NULL) | 1203 |
| 1204 { | 1204 inline FX_FLOAT GetOriginalBorderColor(int index) { |
| 1205 m_pDict = pDict; | 1205 return GetOriginalColor(index, FX_BSTRC("BC")); |
| 1206 } | 1206 } |
| 1207 | 1207 |
| 1208 operator CPDF_Dictionary*() const | 1208 inline void GetOriginalBorderColor(int& iColorType, FX_FLOAT fc[4]) { |
| 1209 { | 1209 GetOriginalColor(iColorType, fc, FX_BSTRC("BC")); |
| 1210 return m_pDict; | 1210 } |
| 1211 } | 1211 |
| 1212 | 1212 inline FX_ARGB GetBackgroundColor(int& iColorType) { |
| 1213 | 1213 return GetColor(iColorType, FX_BSTRC("BG")); |
| 1214 | 1214 } |
| 1215 | 1215 |
| 1216 enum ScaleMethod { | 1216 inline FX_FLOAT GetOriginalBackgroundColor(int index) { |
| 1217 Always = 0, | 1217 return GetOriginalColor(index, FX_BSTRC("BG")); |
| 1218 Bigger, | 1218 } |
| 1219 Smaller, | 1219 |
| 1220 Never | 1220 inline void GetOriginalBackgroundColor(int& iColorType, FX_FLOAT fc[4]) { |
| 1221 }; | 1221 GetOriginalColor(iColorType, fc, FX_BSTRC("BG")); |
| 1222 | 1222 } |
| 1223 ScaleMethod GetScaleMethod(); | 1223 |
| 1224 | 1224 inline CFX_WideString GetNormalCaption() { |
| 1225 | 1225 return GetCaption(FX_BSTRC("CA")); |
| 1226 | 1226 } |
| 1227 | 1227 |
| 1228 FX_BOOL IsProportionalScale(); | 1228 inline CFX_WideString GetRolloverCaption() { |
| 1229 | 1229 return GetCaption(FX_BSTRC("RC")); |
| 1230 | 1230 } |
| 1231 | 1231 |
| 1232 | 1232 inline CFX_WideString GetDownCaption() { return GetCaption(FX_BSTRC("AC")); } |
| 1233 void GetIconPosition(FX_FLOAT& fLeft,
FX_FLOAT& fBottom); | 1233 |
| 1234 | 1234 inline CPDF_Stream* GetNormalIcon() { return GetIcon(FX_BSTRC("I")); } |
| 1235 | 1235 |
| 1236 | 1236 inline CPDF_Stream* GetRolloverIcon() { return GetIcon(FX_BSTRC("RI")); } |
| 1237 | 1237 |
| 1238 FX_BOOL GetFittingBounds(); | 1238 inline CPDF_Stream* GetDownIcon() { return GetIcon(FX_BSTRC("IX")); } |
| 1239 | 1239 |
| 1240 | 1240 CPDF_IconFit GetIconFit(); |
| 1241 CPDF_Dictionary* m_pDict; | 1241 |
| 1242 }; | 1242 int GetTextPosition(); |
| 1243 | 1243 |
| 1244 #define TEXTPOS_CAPTION 0 | 1244 CPDF_Dictionary* m_pDict; |
| 1245 #define TEXTPOS_ICON 1 | 1245 |
| 1246 #define TEXTPOS_BELOW 2 | 1246 protected: |
| 1247 #define TEXTPOS_ABOVE 3 | 1247 FX_ARGB GetColor(int& iColorType, const CFX_ByteStringC& csEntry); |
| 1248 #define TEXTPOS_RIGHT 4 | 1248 |
| 1249 #define TEXTPOS_LEFT 5 | 1249 FX_FLOAT GetOriginalColor(int index, const CFX_ByteStringC& csEntry); |
| 1250 #define TEXTPOS_OVERLAID 6 | 1250 |
| 1251 class CPDF_FormControl | 1251 void GetOriginalColor(int& iColorType, |
| 1252 { | 1252 FX_FLOAT fc[4], |
| 1253 public: | 1253 const CFX_ByteStringC& csEntry); |
| 1254 | 1254 |
| 1255 CPDF_FormField::Type GetType() | 1255 CFX_WideString GetCaption(const CFX_ByteStringC& csEntry); |
| 1256 { | 1256 |
| 1257 return m_pField->GetType(); | 1257 CPDF_Stream* GetIcon(const CFX_ByteStringC& csEntry); |
| 1258 } | 1258 friend class CPDF_FormControl; |
| 1259 | |
| 1260 CPDF_InterForm* GetInterForm() const | |
| 1261 { | |
| 1262 return m_pForm; | |
| 1263 } | |
| 1264 | |
| 1265 CPDF_FormField* GetField() const | |
| 1266 { | |
| 1267 return m_pField; | |
| 1268 } | |
| 1269 | |
| 1270 CPDF_Dictionary* GetWidget() const | |
| 1271 { | |
| 1272 return m_pWidgetDict; | |
| 1273 } | |
| 1274 | |
| 1275 CFX_FloatRect GetRect(); | |
| 1276 | |
| 1277 void DrawControl(CFX_RenderDevice* pD
evice, CFX_AffineMatrix* pMatrix, | |
| 1278 CPDF_Page* pPage, CPDF_Annot::Appearance
Mode mode, const CPDF_RenderOptions* pOptions = NULL); | |
| 1279 | |
| 1280 | |
| 1281 | |
| 1282 CFX_ByteString GetCheckedAPState(); | |
| 1283 | |
| 1284 CFX_WideString GetExportValue(); | |
| 1285 | |
| 1286 FX_BOOL IsChecked(); | |
| 1287 | |
| 1288 FX_BOOL IsDefaultChecked(); | |
| 1289 | |
| 1290 | |
| 1291 | |
| 1292 | |
| 1293 enum HighlightingMode { | |
| 1294 None = 0, | |
| 1295 Invert, | |
| 1296 Outline, | |
| 1297 Push, | |
| 1298 Toggle | |
| 1299 }; | |
| 1300 | |
| 1301 HighlightingMode GetHighlightingMode(); | |
| 1302 | |
| 1303 | |
| 1304 | |
| 1305 | |
| 1306 FX_BOOL HasMKEntry(CFX_ByteString csEntr
y); | |
| 1307 | |
| 1308 | |
| 1309 | |
| 1310 | |
| 1311 int GetRotation(); | |
| 1312 | |
| 1313 | |
| 1314 | |
| 1315 | |
| 1316 inline FX_ARGB GetBorderColor(int& iColorType) | |
| 1317 { | |
| 1318 return GetColor(iColorType, "BC"); | |
| 1319 } | |
| 1320 | |
| 1321 inline FX_FLOAT GetOriginalBorderColor(int index) | |
| 1322 { | |
| 1323 return GetOriginalColor(index, "BC"); | |
| 1324 } | |
| 1325 | |
| 1326 inline void GetOriginalBorderColor(int& iColorType,
FX_FLOAT fc[4]) | |
| 1327 { | |
| 1328 GetOriginalColor(iColorType, fc, "BC"); | |
| 1329 } | |
| 1330 | |
| 1331 | |
| 1332 | |
| 1333 | |
| 1334 inline FX_ARGB GetBackgroundColor(int& iColorType) | |
| 1335 { | |
| 1336 return GetColor(iColorType, "BG"); | |
| 1337 } | |
| 1338 | |
| 1339 inline FX_FLOAT GetOriginalBackgroundColor(int index) | |
| 1340 { | |
| 1341 return GetOriginalColor(index, "BG"); | |
| 1342 } | |
| 1343 | |
| 1344 inline void GetOriginalBackgroundColor(int& iColorTy
pe, FX_FLOAT fc[4]) | |
| 1345 { | |
| 1346 GetOriginalColor(iColorType, fc, "BG"); | |
| 1347 } | |
| 1348 | |
| 1349 | |
| 1350 | |
| 1351 | |
| 1352 inline CFX_WideString GetNormalCaption() | |
| 1353 { | |
| 1354 return GetCaption("CA"); | |
| 1355 } | |
| 1356 | |
| 1357 | |
| 1358 | |
| 1359 | |
| 1360 inline CFX_WideString GetRolloverCaption() | |
| 1361 { | |
| 1362 return GetCaption("RC"); | |
| 1363 } | |
| 1364 | |
| 1365 | |
| 1366 | |
| 1367 | |
| 1368 inline CFX_WideString GetDownCaption() | |
| 1369 { | |
| 1370 return GetCaption("AC"); | |
| 1371 } | |
| 1372 | |
| 1373 | |
| 1374 | |
| 1375 | |
| 1376 inline CPDF_Stream* GetNormalIcon() | |
| 1377 { | |
| 1378 return GetIcon("I"); | |
| 1379 } | |
| 1380 | |
| 1381 | |
| 1382 | |
| 1383 | |
| 1384 inline CPDF_Stream* GetRolloverIcon() | |
| 1385 { | |
| 1386 return GetIcon("RI"); | |
| 1387 } | |
| 1388 | |
| 1389 | |
| 1390 | |
| 1391 | |
| 1392 inline CPDF_Stream* GetDownIcon() | |
| 1393 { | |
| 1394 return GetIcon("IX"); | |
| 1395 } | |
| 1396 | |
| 1397 | |
| 1398 | |
| 1399 | |
| 1400 CPDF_IconFit GetIconFit(); | |
| 1401 | |
| 1402 | |
| 1403 | |
| 1404 | |
| 1405 int GetTextPosition(); | |
| 1406 | |
| 1407 | |
| 1408 | |
| 1409 | |
| 1410 CPDF_Action GetAction(); | |
| 1411 | |
| 1412 | |
| 1413 | |
| 1414 | |
| 1415 CPDF_AAction GetAdditionalAction(); | |
| 1416 | |
| 1417 | |
| 1418 | |
| 1419 | |
| 1420 CPDF_DefaultAppearance GetDefaultAppearance(); | |
| 1421 | |
| 1422 CPDF_Font* GetDefaultControlFont(); | |
| 1423 | |
| 1424 | |
| 1425 | |
| 1426 | |
| 1427 int GetControlAlignment(); | |
| 1428 | |
| 1429 protected: | |
| 1430 | |
| 1431 CPDF_FormControl(CPDF_FormField* pField, CPDF_Dictionary* pWidgetDict); | |
| 1432 | |
| 1433 CFX_ByteString GetOnStateName(); | |
| 1434 | |
| 1435 void SetOnStateName(const CFX_ByteStr
ing& csOn); | |
| 1436 | |
| 1437 void CheckControl(FX_BOOL bChecked); | |
| 1438 | |
| 1439 FX_ARGB GetColor(int& iColorType, CFX_By
teString csEntry); | |
| 1440 | |
| 1441 FX_FLOAT GetOriginalColor(int index, CFX_ByteStri
ng csEntry); | |
| 1442 | |
| 1443 void GetOriginalColor(int& iColorType
, FX_FLOAT fc[4], CFX_ByteString csEntry); | |
| 1444 | |
| 1445 CFX_WideString GetCaption(CFX_ByteString csEntry); | |
| 1446 | |
| 1447 CPDF_Stream* GetIcon(CFX_ByteString csEntry); | |
| 1448 | |
| 1449 CPDF_ApSettings GetMK(FX_BOOL bCreate); | |
| 1450 | |
| 1451 CPDF_InterForm* m_pForm; | |
| 1452 | |
| 1453 CPDF_FormField* m_pField; | |
| 1454 | |
| 1455 CPDF_Dictionary* m_pWidgetDict; | |
| 1456 friend class CPDF_InterForm; | |
| 1457 friend class CPDF_FormField; | |
| 1458 }; | |
| 1459 class CPDF_FormNotify | |
| 1460 { | |
| 1461 public: | |
| 1462 | |
| 1463 virtual ~CPDF_FormNotify() {} | |
| 1464 | |
| 1465 virtual int BeforeValueChange(const CPDF_FormField* pField, CFX_Wide
String& csValue) | |
| 1466 { | |
| 1467 return 0; | |
| 1468 } | |
| 1469 | |
| 1470 virtual int AfterValueChange(const CPDF_FormField* pField) | |
| 1471 { | |
| 1472 return 0; | |
| 1473 } | |
| 1474 | |
| 1475 virtual int BeforeSelectionChange(const CPDF_FormField* pField, CFX_
WideString& csValue) | |
| 1476 { | |
| 1477 return 0; | |
| 1478 } | |
| 1479 | |
| 1480 virtual int AfterSelectionChange(const CPDF_FormField* pField) | |
| 1481 { | |
| 1482 return 0; | |
| 1483 } | |
| 1484 | |
| 1485 virtual int AfterCheckedStatusChange(const CPDF_FormField* pField, c
onst CFX_ByteArray& statusArray) | |
| 1486 { | |
| 1487 return 0; | |
| 1488 } | |
| 1489 | |
| 1490 virtual int BeforeFormReset(const CPDF_InterForm* pForm) | |
| 1491 { | |
| 1492 return 0; | |
| 1493 } | |
| 1494 | |
| 1495 virtual int AfterFormReset(const CPDF_InterForm* pForm) | |
| 1496 { | |
| 1497 return 0; | |
| 1498 } | |
| 1499 | |
| 1500 virtual int BeforeFormImportData(const CPDF_InterForm* pForm) | |
| 1501 { | |
| 1502 return 0; | |
| 1503 } | |
| 1504 | |
| 1505 virtual int AfterFormImportData(const CPDF_InterForm* pForm) | |
| 1506 { | |
| 1507 return 0; | |
| 1508 } | |
| 1509 }; | |
| 1510 FX_BOOL FPDF_GenerateAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict
); | |
| 1511 class CPDF_PageLabel | |
| 1512 { | |
| 1513 public: | |
| 1514 | |
| 1515 CPDF_PageLabel(CPDF_Document* pDocument) | |
| 1516 { | |
| 1517 m_pDocument = pDocument; | |
| 1518 } | |
| 1519 | |
| 1520 | |
| 1521 CFX_WideString GetLabel(int nPage) cons
t; | |
| 1522 | |
| 1523 int32_t GetPageByLabel(const CFX
_ByteStringC& bsLabel) const; | |
| 1524 | |
| 1525 | |
| 1526 int32_t GetPageByLabel(const CFX
_WideStringC& wsLabel) const; | |
| 1527 | |
| 1528 protected: | |
| 1529 CPDF_Document* m_pDocument; | |
| 1530 }; | |
| 1531 class CPDF_Metadata | |
| 1532 { | |
| 1533 public: | |
| 1534 | |
| 1535 CPDF_Metadata(); | |
| 1536 | |
| 1537 | |
| 1538 ~CPDF_Metadata(); | |
| 1539 | |
| 1540 void LoadDoc(CPDF_Document *pDoc); | |
| 1541 | |
| 1542 | |
| 1543 int32_t GetString(const CFX_ByteStringC& bsItem, CFX_Wid
eString &wsStr); | |
| 1544 | |
| 1545 CXML_Element* GetRoot() const; | |
| 1546 | |
| 1547 CXML_Element* GetRDF() const; | |
| 1548 | |
| 1549 protected: | |
| 1550 void* m_pData; | |
| 1551 }; | |
| 1552 class CPDF_ViewerPreferences | |
| 1553 { | |
| 1554 public: | |
| 1555 | |
| 1556 CPDF_ViewerPreferences(CPDF_Document *pDoc); | |
| 1557 | |
| 1558 | |
| 1559 ~CPDF_ViewerPreferences(); | |
| 1560 | |
| 1561 | |
| 1562 FX_BOOL IsDirectionR2L() const; | |
| 1563 | |
| 1564 FX_BOOL PrintScaling() const; | |
| 1565 | |
| 1566 int32_t NumCopies() const; | |
| 1567 | |
| 1568 CPDF_Array* PrintPageRange() const; | |
| 1569 | |
| 1570 CFX_ByteString Duplex() const; | |
| 1571 | |
| 1572 protected: | |
| 1573 CPDF_Document* m_pDoc; | |
| 1574 }; | |
| 1575 class CPDF_ApSettings | |
| 1576 { | |
| 1577 public: | |
| 1578 | |
| 1579 CPDF_ApSettings(CPDF_Dictionary* pDict = NULL) | |
| 1580 { | |
| 1581 m_pDict = pDict; | |
| 1582 } | |
| 1583 | |
| 1584 operator CPDF_Dictionary* () const | |
| 1585 { | |
| 1586 return m_pDict; | |
| 1587 } | |
| 1588 | |
| 1589 FX_BOOL HasMKEntry(const CFX_ByteStringC
& csEntry); | |
| 1590 | |
| 1591 | |
| 1592 | |
| 1593 int GetRotation(); | |
| 1594 | |
| 1595 | |
| 1596 | |
| 1597 | |
| 1598 inline FX_ARGB GetBorderColor(int& iColorType) | |
| 1599 { | |
| 1600 return GetColor(iColorType, FX_BSTRC("BC")); | |
| 1601 } | |
| 1602 | |
| 1603 inline FX_FLOAT GetOriginalBorderColor(int index) | |
| 1604 { | |
| 1605 return GetOriginalColor(index, FX_BSTRC("BC")); | |
| 1606 } | |
| 1607 | |
| 1608 inline void GetOriginalBorderColor(int& iColorType,
FX_FLOAT fc[4]) | |
| 1609 { | |
| 1610 GetOriginalColor(iColorType, fc, FX_BSTRC("BC")); | |
| 1611 } | |
| 1612 | |
| 1613 | |
| 1614 | |
| 1615 | |
| 1616 inline FX_ARGB GetBackgroundColor(int& iColorType) | |
| 1617 { | |
| 1618 return GetColor(iColorType, FX_BSTRC("BG")); | |
| 1619 } | |
| 1620 | |
| 1621 inline FX_FLOAT GetOriginalBackgroundColor(int index) | |
| 1622 { | |
| 1623 return GetOriginalColor(index, FX_BSTRC("BG")); | |
| 1624 } | |
| 1625 | |
| 1626 inline void GetOriginalBackgroundColor(int& iColorTy
pe, FX_FLOAT fc[4]) | |
| 1627 { | |
| 1628 GetOriginalColor(iColorType, fc, FX_BSTRC("BG")); | |
| 1629 } | |
| 1630 | |
| 1631 | |
| 1632 | |
| 1633 | |
| 1634 inline CFX_WideString GetNormalCaption() | |
| 1635 { | |
| 1636 return GetCaption(FX_BSTRC("CA")); | |
| 1637 } | |
| 1638 | |
| 1639 | |
| 1640 | |
| 1641 | |
| 1642 inline CFX_WideString GetRolloverCaption() | |
| 1643 { | |
| 1644 return GetCaption(FX_BSTRC("RC")); | |
| 1645 } | |
| 1646 | |
| 1647 | |
| 1648 | |
| 1649 | |
| 1650 inline CFX_WideString GetDownCaption() | |
| 1651 { | |
| 1652 return GetCaption(FX_BSTRC("AC")); | |
| 1653 } | |
| 1654 | |
| 1655 | |
| 1656 | |
| 1657 | |
| 1658 inline CPDF_Stream* GetNormalIcon() | |
| 1659 { | |
| 1660 return GetIcon(FX_BSTRC("I")); | |
| 1661 } | |
| 1662 | |
| 1663 | |
| 1664 | |
| 1665 | |
| 1666 inline CPDF_Stream* GetRolloverIcon() | |
| 1667 { | |
| 1668 return GetIcon(FX_BSTRC("RI")); | |
| 1669 } | |
| 1670 | |
| 1671 | |
| 1672 | |
| 1673 | |
| 1674 inline CPDF_Stream* GetDownIcon() | |
| 1675 { | |
| 1676 return GetIcon(FX_BSTRC("IX")); | |
| 1677 } | |
| 1678 | |
| 1679 | |
| 1680 | |
| 1681 | |
| 1682 CPDF_IconFit GetIconFit(); | |
| 1683 | |
| 1684 | |
| 1685 | |
| 1686 | |
| 1687 int GetTextPosition(); | |
| 1688 | |
| 1689 CPDF_Dictionary* m_pDict; | |
| 1690 protected: | |
| 1691 | |
| 1692 FX_ARGB GetColor(int& iColorType, const
CFX_ByteStringC& csEntry); | |
| 1693 | |
| 1694 FX_FLOAT GetOriginalColor(int index, const CFX_By
teStringC& csEntry); | |
| 1695 | |
| 1696 void GetOriginalColor(int& iColorType
, FX_FLOAT fc[4], const CFX_ByteStringC& csEntry); | |
| 1697 | |
| 1698 CFX_WideString GetCaption(const CFX_ByteStringC& csEntr
y); | |
| 1699 | |
| 1700 CPDF_Stream* GetIcon(const CFX_ByteStringC& csEntry); | |
| 1701 friend class CPDF_FormControl; | |
| 1702 }; | 1259 }; |
| 1703 | 1260 |
| 1704 #endif // CORE_INCLUDE_FPDFDOC_FPDF_DOC_H_ | 1261 #endif // CORE_INCLUDE_FPDFDOC_FPDF_DOC_H_ |
| OLD | NEW |