Revert "Remove IPDFSDK_AnnotHandler interface."
[pdfium.git] / fpdfsdk / include / fsdk_baseannot.h
index b6cadb7..bfeebeb 100644 (file)
-// Copyright 2014 PDFium Authors. All rights reserved.\r
-// Use of this source code is governed by a BSD-style license that can be\r
-// found in the LICENSE file.\r
\r
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com\r
-\r
-#ifndef _FSDK_BASEANNOT_H_\r
-#define _FSDK_BASEANNOT_H_\r
-\r
-#if _FX_OS_ == _FX_ANDROID_\r
-#include "time.h"\r
-#else\r
-#include <ctime>\r
-#endif\r
-\r
-class CPDFSDK_PageView;\r
-#define CFX_IntArray                           CFX_ArrayTemplate<int>\r
-\r
-class  CPDFSDK_DateTime : public CFX_Object\r
-{\r
-public:\r
-       CPDFSDK_DateTime();\r
-       CPDFSDK_DateTime(const CFX_ByteString& dtStr);\r
-       CPDFSDK_DateTime(const CPDFSDK_DateTime& datetime);\r
-       CPDFSDK_DateTime(const FX_SYSTEMTIME& st);\r
-       \r
-       \r
-       CPDFSDK_DateTime&       operator = (const CPDFSDK_DateTime& datetime);\r
-       CPDFSDK_DateTime&       operator = (const FX_SYSTEMTIME& st);\r
-       FX_BOOL                         operator == (CPDFSDK_DateTime& datetime);\r
-       FX_BOOL                         operator != (CPDFSDK_DateTime& datetime);\r
-       FX_BOOL                         operator > (CPDFSDK_DateTime& datetime);\r
-       FX_BOOL                         operator >= (CPDFSDK_DateTime& datetime);\r
-       FX_BOOL                         operator < (CPDFSDK_DateTime& datetime);\r
-       FX_BOOL                         operator <= (CPDFSDK_DateTime& datetime);       \r
-                                               operator time_t();\r
-       \r
-       CPDFSDK_DateTime&       FromPDFDateTimeString(const CFX_ByteString& dtStr);\r
-       CFX_ByteString          ToCommonDateTimeString();\r
-       CFX_ByteString          ToPDFDateTimeString();\r
-       void                            ToSystemTime(FX_SYSTEMTIME& st);\r
-       CPDFSDK_DateTime        ToGMT();\r
-       CPDFSDK_DateTime&       AddDays(short days);\r
-       CPDFSDK_DateTime&       AddSeconds(int seconds);\r
-       \r
-       void                            ResetDateTime();\r
-       \r
-       struct FX_DATETIME\r
-       {\r
-               FX_SHORT        year;\r
-               FX_BYTE         month;\r
-               FX_BYTE         day;\r
-               FX_BYTE         hour;\r
-               FX_BYTE         minute;\r
-               FX_BYTE         second;\r
-               FX_CHAR         tzHour;\r
-               FX_BYTE         tzMinute;\r
-       }dt;\r
-};\r
-\r
-class CPDFSDK_Annot\r
-{\r
-public:\r
-       CPDFSDK_Annot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView);\r
-       virtual ~CPDFSDK_Annot();\r
-public:\r
-       virtual FX_FLOAT                        GetMinWidth() const;\r
-       virtual FX_FLOAT                        GetMinHeight() const;\r
-       //define layout order to 5.\r
-       virtual int                                     GetLayoutOrder() const { return 5; }\r
-\r
-public:\r
-       CPDF_Annot*                                     GetPDFAnnot();\r
-       \r
-       void                                            SetPage(CPDFSDK_PageView* pPageView);\r
-       CPDFSDK_PageView*                       GetPageView();  \r
-       FX_DWORD                                        GetFlags();\r
-       \r
-       // Tab Order    \r
-       int                                                     GetTabOrder();\r
-       void                                            SetTabOrder(int iTabOrder);\r
-       \r
-       // Selection\r
-       FX_BOOL                                         IsSelected();\r
-       void                                            SetSelected(FX_BOOL bSelected);\r
-       \r
-       CFX_ByteString                          GetType() const;\r
-       virtual CFX_ByteString          GetSubType() const;\r
-\r
-       CPDF_Page*                                      GetPDFPage();\r
-\r
-public:\r
-       CPDF_Dictionary*                        GetAnnotDict() const;\r
-       \r
-       void                                            SetRect(const CPDF_Rect& rect);\r
-       CPDF_Rect                                       GetRect() const;\r
-       \r
-       void                                            SetContents(const CFX_WideString& sContents);\r
-       CFX_WideString                          GetContents() const;\r
-       \r
-       void                                            SetAnnotName(const CFX_WideString& sName);\r
-       CFX_WideString                          GetAnnotName() const;\r
-       \r
-       void                                            SetModifiedDate(const FX_SYSTEMTIME& st);\r
-       FX_SYSTEMTIME                           GetModifiedDate() const;\r
-\r
-       void                                            SetFlags(int nFlags);\r
-       int                                                     GetFlags() const;\r
-\r
-       void                                            SetAppState(const CFX_ByteString& str);\r
-       CFX_ByteString                          GetAppState() const;\r
-       \r
-       void                                            SetStructParent(int key);\r
-       int                                                     GetStructParent() const;\r
-       \r
-       //border\r
-       void                                            SetBorderWidth(int nWidth);\r
-       int                                                     GetBorderWidth() const;\r
-       \r
-       //BBS_SOLID\r
-       //BBS_DASH\r
-       //BBS_BEVELED\r
-       //BBS_INSET\r
-       //BBS_UNDERLINE\r
-       \r
-       void                                            SetBorderStyle(int nStyle);\r
-       int                                                     GetBorderStyle() const;\r
-       \r
-       void                                            SetBorderDash(const CFX_IntArray& array);\r
-       void                                            GetBorderDash(CFX_IntArray& array) const;\r
-       \r
-       //The background of the annotation's icon when closed\r
-       //The title bar of the annotation's pop-up window\r
-       //The border of a link annotation\r
-       \r
-       void                                            SetColor(FX_COLORREF color);\r
-       void                                            RemoveColor();\r
-       FX_BOOL                                         GetColor(FX_COLORREF& color) const;\r
-       \r
-       FX_BOOL                                         IsVisible() const;\r
-       //action\r
-\r
-       CPDF_Action                                     GetAction() const;\r
-       void                                            SetAction(const CPDF_Action& a);\r
-       void                                            RemoveAction();\r
-       \r
-       CPDF_AAction                            GetAAction() const;\r
-       void                                            SetAAction(const CPDF_AAction& aa);\r
-       void                                            RemoveAAction();\r
-       \r
-       virtual CPDF_Action                     GetAAction(CPDF_AAction::AActionType eAAT);\r
-       \r
-public:\r
-       FX_BOOL                                         IsAppearanceValid();\r
-       FX_BOOL                                         IsAppearanceValid(CPDF_Annot::AppearanceMode mode);\r
-       void                                            DrawAppearance(CFX_RenderDevice* pDevice, const CPDF_Matrix* pUser2Device,\r
-               CPDF_Annot::AppearanceMode mode, const CPDF_RenderOptions* pOptions);\r
-       void                                            DrawBorder(CFX_RenderDevice* pDevice, const CPDF_Matrix* pUser2Device,\r
-               const CPDF_RenderOptions* pOptions);\r
-       \r
-       void                                            ClearCachedAP();\r
-       \r
-       virtual void                            ResetAppearance();\r
-       void                                            WriteAppearance(const CFX_ByteString& sAPType, const CPDF_Rect& rcBBox, \r
-               const CPDF_Matrix& matrix, const CFX_ByteString& sContents,\r
-               const CFX_ByteString& sAPState = "");\r
-\r
-public:\r
-       virtual void                    Annot_OnDraw(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,CPDF_RenderOptions* pOptions);\r
-public:\r
-\r
-\r
-private:\r
-       FX_BOOL CreateFormFiller();\r
-protected:\r
-       CPDF_Annot*                     m_pAnnot;\r
-       CPDFSDK_PageView*       m_pPageView;\r
-       FX_BOOL                         m_bSelected;\r
-       int                                     m_nTabOrder;\r
-       \r
-};\r
-\r
-\r
-\r
-#endif\r
-\r
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FPDFSDK_INCLUDE_FSDK_BASEANNOT_H_
+#define FPDFSDK_INCLUDE_FSDK_BASEANNOT_H_
+
+#if _FX_OS_ == _FX_ANDROID_
+#include "time.h"
+#else
+#include <ctime>
+#endif
+
+#include "../../core/include/fpdfdoc/fpdf_doc.h"
+#include "../../core/include/fxcrt/fx_basic.h"
+#include "fx_systemhandler.h"
+
+class CPDFSDK_PageView;
+class CPDF_Annot;
+class CPDF_Page;
+class CPDF_Rect;
+class CPDF_Matrix;
+class CPDF_RenderOptions;
+class CFX_RenderDevice;
+
+#define CFX_IntArray CFX_ArrayTemplate<int>
+
+class CPDFSDK_DateTime {
+ public:
+  CPDFSDK_DateTime();
+  CPDFSDK_DateTime(const CFX_ByteString& dtStr);
+  CPDFSDK_DateTime(const CPDFSDK_DateTime& datetime);
+  CPDFSDK_DateTime(const FX_SYSTEMTIME& st);
+
+  CPDFSDK_DateTime& operator=(const CPDFSDK_DateTime& datetime);
+  CPDFSDK_DateTime& operator=(const FX_SYSTEMTIME& st);
+  FX_BOOL operator==(CPDFSDK_DateTime& datetime);
+  FX_BOOL operator!=(CPDFSDK_DateTime& datetime);
+  FX_BOOL operator>(CPDFSDK_DateTime& datetime);
+  FX_BOOL operator>=(CPDFSDK_DateTime& datetime);
+  FX_BOOL operator<(CPDFSDK_DateTime& datetime);
+  FX_BOOL operator<=(CPDFSDK_DateTime& datetime);
+  operator time_t();
+
+  CPDFSDK_DateTime& FromPDFDateTimeString(const CFX_ByteString& dtStr);
+  CFX_ByteString ToCommonDateTimeString();
+  CFX_ByteString ToPDFDateTimeString();
+  void ToSystemTime(FX_SYSTEMTIME& st);
+  CPDFSDK_DateTime ToGMT();
+  CPDFSDK_DateTime& AddDays(short days);
+  CPDFSDK_DateTime& AddSeconds(int seconds);
+
+  void ResetDateTime();
+
+  struct FX_DATETIME {
+    int16_t year;
+    uint8_t month;
+    uint8_t day;
+    uint8_t hour;
+    uint8_t minute;
+    uint8_t second;
+    int8_t tzHour;
+    uint8_t tzMinute;
+  } dt;
+};
+
+class CPDFSDK_Annot {
+ public:
+  CPDFSDK_Annot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView);
+  virtual ~CPDFSDK_Annot();
+
+ public:
+  virtual FX_FLOAT GetMinWidth() const;
+  virtual FX_FLOAT GetMinHeight() const;
+  // define layout order to 5.
+  virtual int GetLayoutOrder() const { return 5; }
+
+ public:
+  CPDF_Annot* GetPDFAnnot();
+
+  void SetPage(CPDFSDK_PageView* pPageView);
+  CPDFSDK_PageView* GetPageView();
+  FX_DWORD GetFlags();
+
+  // Tab Order
+  int GetTabOrder();
+  void SetTabOrder(int iTabOrder);
+
+  // Selection
+  FX_BOOL IsSelected();
+  void SetSelected(FX_BOOL bSelected);
+
+  CFX_ByteString GetType() const;
+  virtual CFX_ByteString GetSubType() const;
+
+  CPDF_Page* GetPDFPage();
+
+ public:
+  CPDF_Dictionary* GetAnnotDict() const;
+
+  void SetRect(const CPDF_Rect& rect);
+  CPDF_Rect GetRect() const;
+
+  void SetContents(const CFX_WideString& sContents);
+  CFX_WideString GetContents() const;
+
+  void SetAnnotName(const CFX_WideString& sName);
+  CFX_WideString GetAnnotName() const;
+
+  void SetModifiedDate(const FX_SYSTEMTIME& st);
+  FX_SYSTEMTIME GetModifiedDate() const;
+
+  void SetFlags(int nFlags);
+  int GetFlags() const;
+
+  void SetAppState(const CFX_ByteString& str);
+  CFX_ByteString GetAppState() const;
+
+  void SetStructParent(int key);
+  int GetStructParent() const;
+
+  // border
+  void SetBorderWidth(int nWidth);
+  int GetBorderWidth() const;
+
+  // BBS_SOLID
+  // BBS_DASH
+  // BBS_BEVELED
+  // BBS_INSET
+  // BBS_UNDERLINE
+
+  void SetBorderStyle(int nStyle);
+  int GetBorderStyle() const;
+
+  void SetBorderDash(const CFX_IntArray& array);
+  void GetBorderDash(CFX_IntArray& array) const;
+
+  // The background of the annotation's icon when closed
+  // The title bar of the annotation's pop-up window
+  // The border of a link annotation
+
+  void SetColor(FX_COLORREF color);
+  void RemoveColor();
+  FX_BOOL GetColor(FX_COLORREF& color) const;
+
+  FX_BOOL IsVisible() const;
+  // action
+
+  CPDF_Action GetAction() const;
+  void SetAction(const CPDF_Action& a);
+  void RemoveAction();
+
+  CPDF_AAction GetAAction() const;
+  void SetAAction(const CPDF_AAction& aa);
+  void RemoveAAction();
+
+  virtual CPDF_Action GetAAction(CPDF_AAction::AActionType eAAT);
+
+ public:
+  FX_BOOL IsAppearanceValid();
+  FX_BOOL IsAppearanceValid(CPDF_Annot::AppearanceMode mode);
+  void DrawAppearance(CFX_RenderDevice* pDevice,
+                      const CPDF_Matrix* pUser2Device,
+                      CPDF_Annot::AppearanceMode mode,
+                      const CPDF_RenderOptions* pOptions);
+  void DrawBorder(CFX_RenderDevice* pDevice,
+                  const CPDF_Matrix* pUser2Device,
+                  const CPDF_RenderOptions* pOptions);
+
+  void ClearCachedAP();
+
+  void WriteAppearance(const CFX_ByteString& sAPType,
+                       const CPDF_Rect& rcBBox,
+                       const CPDF_Matrix& matrix,
+                       const CFX_ByteString& sContents,
+                       const CFX_ByteString& sAPState = "");
+
+ public:
+  virtual void Annot_OnDraw(CFX_RenderDevice* pDevice,
+                            CPDF_Matrix* pUser2Device,
+                            CPDF_RenderOptions* pOptions);
+
+ public:
+ private:
+  FX_BOOL CreateFormFiller();
+
+ protected:
+  CPDF_Annot* m_pAnnot;
+  CPDFSDK_PageView* m_pPageView;
+  FX_BOOL m_bSelected;
+  int m_nTabOrder;
+};
+
+#endif  // FPDFSDK_INCLUDE_FSDK_BASEANNOT_H_