Merge XFA to PDFium master at 4dc95e7 on 10/28/2014
[pdfium.git] / fpdfsdk / include / pdfwindow / PWL_Edit.h
index 71f6756..6af324d 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 _PWL_EDIT_H_\r
-#define _PWL_EDIT_H_\r
-\r
-class IPWL_Filler_Notify;\r
-class CPWL_Edit;\r
-class IPWL_SpellCheck;\r
-\r
-class IPWL_Filler_Notify\r
-{\r
-public:\r
-       virtual void                                    QueryWherePopup(void* pPrivateData, FX_FLOAT fPopupMin,FX_FLOAT fPopupMax, \r
-                                                                               FX_INT32 & nRet, FX_FLOAT & fPopupRet) = 0; //nRet: (0:bottom 1:top)\r
-       virtual void                                    OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_INT32 nKeyCode,\r
-                                                                               CFX_WideString & strChange, const CFX_WideString& strChangeEx, \r
-                                                                               int nSelStart, int nSelEnd,\r
-                                                                               FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL & bExit, FX_DWORD nFlag) = 0;\r
-       virtual void                                    OnAfterKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_BOOL & bExit, FX_DWORD nFlag) = 0;\r
-};\r
-\r
-class PWL_CLASS CPWL_Edit : public CPWL_EditCtrl, public IFX_Edit_OprNotify\r
-{\r
-public:\r
-       CPWL_Edit();\r
-       virtual ~CPWL_Edit();\r
-\r
-public:\r
-       virtual CFX_ByteString                  GetClassName() const;\r
-       virtual void                                    OnDestroy();\r
-       virtual void                                    OnCreated();\r
-       virtual void                                    RePosChildWnd();\r
-       virtual CPDF_Rect                               GetClientRect() const;\r
-\r
-       virtual void                                    GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);\r
-       virtual void                                    DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);\r
-\r
-       virtual FX_BOOL                                 OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);\r
-       virtual FX_BOOL                                 OnLButtonDblClk(const CPDF_Point & point, FX_DWORD nFlag);\r
-       virtual FX_BOOL                                 OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag);\r
-       virtual FX_BOOL                                 OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag);\r
-\r
-       virtual FX_BOOL                                 OnKeyDown(FX_WORD nChar, FX_DWORD nFlag);\r
-       virtual FX_BOOL                                 OnChar(FX_WORD nChar, FX_DWORD nFlag);\r
-\r
-       virtual CPDF_Rect                               GetFocusRect() const;\r
-\r
-public:                \r
-       void                                                    SetAlignFormatH(PWL_EDIT_ALIGNFORMAT_H nFormat = PEAH_LEFT, FX_BOOL bPaint = TRUE);     //0:left 1:right 2:middle \r
-       void                                                    SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat = PEAV_TOP, FX_BOOL bPaint = TRUE);      //0:top 1:bottom 2:center\r
-\r
-       void                                                    SetCharArray(FX_INT32 nCharArray);\r
-       void                                                    SetLimitChar(FX_INT32 nLimitChar);\r
-\r
-       void                                                    SetHorzScale(FX_INT32 nHorzScale, FX_BOOL bPaint = TRUE);\r
-       void                                                    SetCharSpace(FX_FLOAT fCharSpace, FX_BOOL bPaint = TRUE);\r
-\r
-       void                                                    SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE);\r
-\r
-       void                                                    EnableSpellCheck(FX_BOOL bEnabled);\r
-\r
-       FX_BOOL                                                 CanSelectAll() const;\r
-       FX_BOOL                                                 CanClear() const;\r
-       FX_BOOL                                                 CanCopy() const;\r
-       FX_BOOL                                                 CanCut() const;\r
-       FX_BOOL                                                 CanPaste() const;\r
-\r
-       virtual void                                    CopyText();\r
-       virtual void                                    PasteText();\r
-       virtual void                                    CutText();\r
-\r
-       virtual void                                    SetText(FX_LPCWSTR csText);\r
-       void                                                    ReplaceSel(FX_LPCWSTR csText);\r
-\r
-       CFX_ByteString                                  GetTextAppearanceStream(const CPDF_Point & ptOffset) const;\r
-       CFX_ByteString                                  GetCaretAppearanceStream(const CPDF_Point & ptOffset) const;    \r
-       CFX_ByteString                                  GetSelectAppearanceStream(const CPDF_Point & ptOffset) const;\r
-\r
-       FX_BOOL                                                 IsTextFull() const;     \r
-\r
-       static FX_FLOAT                                 GetCharArrayAutoFontSize(CPDF_Font* pFont, const CPDF_Rect& rcPlate, FX_INT32 nCharArray);\r
-\r
-       void                                                    SetFillerNotify(IPWL_Filler_Notify* pNotify) {m_pFillerNotify = pNotify;}\r
-\r
-       void                                                    GeneratePageObjects(CPDF_PageObjects* pPageObjects, \r
-                                                                               const CPDF_Point& ptOffset, CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray);\r
-       void                                                    GeneratePageObjects(CPDF_PageObjects* pPageObjects, \r
-                                                                               const CPDF_Point& ptOffset);\r
-\r
-protected:\r
-       virtual void                                    OnSetFocus();\r
-       virtual void                                    OnKillFocus();\r
-\r
-protected:\r
-       virtual void                                    OnInsertWord(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);\r
-       virtual void                                    OnInsertReturn(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);\r
-       virtual void                                    OnBackSpace(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);\r
-       virtual void                                    OnDelete(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);\r
-       virtual void                                    OnClear(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);\r
-       virtual void                                    OnSetText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);\r
-       virtual void                                    OnInsertText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);\r
-       virtual void                                    OnAddUndo(IFX_Edit_UndoItem* pUndoItem);\r
-\r
-private:       \r
-       CPVT_WordRange                                  GetSelectWordRange() const;\r
-       virtual void                                    ShowVScrollBar(FX_BOOL bShow);\r
-       FX_BOOL                                                 IsVScrollBarVisible() const;\r
-       void                                                    SetParamByFlag();\r
-\r
-       FX_FLOAT                                                GetCharArrayAutoFontSize(FX_INT32 nCharArray);\r
-       CPDF_Point                                              GetWordRightBottomPoint(const CPVT_WordPlace& wpWord);\r
-\r
-       CPVT_WordRange                                  CombineWordRange(const CPVT_WordRange& wr1, const CPVT_WordRange& wr2);\r
-       CPVT_WordRange                                  GetLatinWordsRange(const CPDF_Point & point) const;\r
-       CPVT_WordRange                                  GetLatinWordsRange(const CPVT_WordPlace & place) const;\r
-       CPVT_WordRange                                  GetArabicWordsRange(const CPVT_WordPlace & place) const;\r
-       CPVT_WordRange                                  GetSameWordsRange(const CPVT_WordPlace & place, FX_BOOL bLatin, FX_BOOL bArabic) const;\r
-\r
-       void                                                    AjustArabicWords(const CPVT_WordRange& wr);\r
-public:\r
-       FX_BOOL                                                 IsProceedtoOnChar(FX_WORD nKeyCode, FX_DWORD nFlag);\r
-private:\r
-       IPWL_Filler_Notify*                             m_pFillerNotify;\r
-       IPWL_SpellCheck*                                m_pSpellCheck;\r
-       FX_BOOL                                                 m_bFocus;\r
-       CPDF_Rect                                               m_rcOldWindow;\r
-public:\r
-       void                                                    AttachFFLData(void* pData) {m_pFormFiller = pData;}\r
-private:\r
-       void*                                                   m_pFormFiller;\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 _PWL_EDIT_H_
+#define _PWL_EDIT_H_
+
+class IPWL_Filler_Notify;
+class CPWL_Edit;
+class IPWL_SpellCheck;
+
+class IPWL_Filler_Notify
+{
+public:
+       virtual void                                    QueryWherePopup(void* pPrivateData, FX_FLOAT fPopupMin,FX_FLOAT fPopupMax, 
+                                                                               FX_INT32 & nRet, FX_FLOAT & fPopupRet) = 0; //nRet: (0:bottom 1:top)
+       virtual void                                    OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_INT32 nKeyCode,
+                                                                               CFX_WideString & strChange, const CFX_WideString& strChangeEx, 
+                                                                               int nSelStart, int nSelEnd,
+                                                                               FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL & bExit, FX_DWORD nFlag) = 0;
+       virtual void                                    OnAfterKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_BOOL & bExit, FX_DWORD nFlag) = 0;
+
+       virtual void                                    OnPopupPreOpen(void* pPrivateData, FX_BOOL& bExit, FX_DWORD nFlag) = 0;
+       virtual void                                    OnPopupPostOpen(void* pPrivateData, FX_BOOL& bExit, FX_DWORD nFlag) = 0;
+};
+
+class PWL_CLASS CPWL_Edit : public CPWL_EditCtrl, public IFX_Edit_OprNotify
+{
+public:
+       CPWL_Edit();
+       virtual ~CPWL_Edit();
+
+public:
+       virtual CFX_ByteString                  GetClassName() const;
+       virtual void                                    OnDestroy();
+       virtual void                                    OnCreated();
+       virtual void                                    RePosChildWnd();
+       virtual CPDF_Rect                               GetClientRect() const;
+
+       virtual void                                    GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);
+       virtual void                                    DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
+
+       virtual FX_BOOL                                 OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
+       virtual FX_BOOL                                 OnLButtonDblClk(const CPDF_Point & point, FX_DWORD nFlag);
+       virtual FX_BOOL                                 OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
+       virtual FX_BOOL                                 OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag);
+
+       virtual FX_BOOL                                 OnKeyDown(FX_WORD nChar, FX_DWORD nFlag);
+       virtual FX_BOOL                                 OnChar(FX_WORD nChar, FX_DWORD nFlag);
+
+       virtual CPDF_Rect                               GetFocusRect() const;
+
+public:                
+       void                                                    SetAlignFormatH(PWL_EDIT_ALIGNFORMAT_H nFormat = PEAH_LEFT, FX_BOOL bPaint = TRUE);     //0:left 1:right 2:middle 
+       void                                                    SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat = PEAV_TOP, FX_BOOL bPaint = TRUE);      //0:top 1:bottom 2:center
+
+       void                                                    SetCharArray(FX_INT32 nCharArray);
+       void                                                    SetLimitChar(FX_INT32 nLimitChar);
+
+       void                                                    SetHorzScale(FX_INT32 nHorzScale, FX_BOOL bPaint = TRUE);
+       void                                                    SetCharSpace(FX_FLOAT fCharSpace, FX_BOOL bPaint = TRUE);
+
+       void                                                    SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE);
+
+       void                                                    EnableSpellCheck(FX_BOOL bEnabled);
+
+       FX_BOOL                                                 CanSelectAll() const;
+       FX_BOOL                                                 CanClear() const;
+       FX_BOOL                                                 CanCopy() const;
+       FX_BOOL                                                 CanCut() const;
+       FX_BOOL                                                 CanPaste() const;
+
+       virtual void                                    CopyText();
+       virtual void                                    PasteText();
+       virtual void                                    CutText();
+
+       virtual void                                    SetText(FX_LPCWSTR csText);
+       void                                                    ReplaceSel(FX_LPCWSTR csText);
+
+       CFX_ByteString                                  GetTextAppearanceStream(const CPDF_Point & ptOffset) const;
+       CFX_ByteString                                  GetCaretAppearanceStream(const CPDF_Point & ptOffset) const;    
+       CFX_ByteString                                  GetSelectAppearanceStream(const CPDF_Point & ptOffset) const;
+
+       FX_BOOL                                                 IsTextFull() const;     
+
+       static FX_FLOAT                                 GetCharArrayAutoFontSize(CPDF_Font* pFont, const CPDF_Rect& rcPlate, FX_INT32 nCharArray);
+
+       void                                                    SetFillerNotify(IPWL_Filler_Notify* pNotify) {m_pFillerNotify = pNotify;}
+
+       void                                                    GeneratePageObjects(CPDF_PageObjects* pPageObjects, 
+                                                                               const CPDF_Point& ptOffset, CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray);
+       void                                                    GeneratePageObjects(CPDF_PageObjects* pPageObjects, 
+                                                                               const CPDF_Point& ptOffset);
+
+protected:
+       virtual void                                    OnSetFocus();
+       virtual void                                    OnKillFocus();
+
+protected:
+       virtual void                                    OnInsertWord(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);
+       virtual void                                    OnInsertReturn(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);
+       virtual void                                    OnBackSpace(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);
+       virtual void                                    OnDelete(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);
+       virtual void                                    OnClear(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);
+       virtual void                                    OnSetText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);
+       virtual void                                    OnInsertText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);
+       virtual void                                    OnAddUndo(IFX_Edit_UndoItem* pUndoItem);
+
+private:       
+       CPVT_WordRange                                  GetSelectWordRange() const;
+       virtual void                                    ShowVScrollBar(FX_BOOL bShow);
+       FX_BOOL                                                 IsVScrollBarVisible() const;
+       void                                                    SetParamByFlag();
+
+       FX_FLOAT                                                GetCharArrayAutoFontSize(FX_INT32 nCharArray);
+       CPDF_Point                                              GetWordRightBottomPoint(const CPVT_WordPlace& wpWord);
+
+       CPVT_WordRange                                  CombineWordRange(const CPVT_WordRange& wr1, const CPVT_WordRange& wr2);
+       CPVT_WordRange                                  GetLatinWordsRange(const CPDF_Point & point) const;
+       CPVT_WordRange                                  GetLatinWordsRange(const CPVT_WordPlace & place) const;
+       CPVT_WordRange                                  GetArabicWordsRange(const CPVT_WordPlace & place) const;
+       CPVT_WordRange                                  GetSameWordsRange(const CPVT_WordPlace & place, FX_BOOL bLatin, FX_BOOL bArabic) const;
+
+       void                                                    AjustArabicWords(const CPVT_WordRange& wr);
+public:
+       FX_BOOL                                                 IsProceedtoOnChar(FX_WORD nKeyCode, FX_DWORD nFlag);
+private:
+       IPWL_Filler_Notify*                             m_pFillerNotify;
+       IPWL_SpellCheck*                                m_pSpellCheck;
+       FX_BOOL                                                 m_bFocus;
+       CPDF_Rect                                               m_rcOldWindow;
+public:
+       void                                                    AttachFFLData(void* pData) {m_pFormFiller = pData;}
+private:
+       void*                                                   m_pFormFiller;
+};
+
+#endif 
+