summaryrefslogtreecommitdiff
path: root/xfa/include
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/include')
-rw-r--r--xfa/include/fxfa/xfa_ffapp.h3
-rw-r--r--xfa/include/fxfa/xfa_ffdochandler.h24
-rw-r--r--xfa/include/fxfa/xfa_ffwidget.h185
-rw-r--r--xfa/include/fxfa/xfa_ffwidgethandler.h48
4 files changed, 188 insertions, 72 deletions
diff --git a/xfa/include/fxfa/xfa_ffapp.h b/xfa/include/fxfa/xfa_ffapp.h
index c3bae4874c..c17b9e66de 100644
--- a/xfa/include/fxfa/xfa_ffapp.h
+++ b/xfa/include/fxfa/xfa_ffapp.h
@@ -19,7 +19,6 @@ class CXFA_DefFontMgr;
class CXFA_FWLAdapterWidgetMgr;
class CXFA_FWLTheme;
class CXFA_FFDocHandler;
-class CXFA_FFMenuHandler;
class CXFA_FontMgr;
class CXFA_FileRead : public IFX_FileRead {
@@ -47,7 +46,6 @@ class CXFA_FFApp : public IFWL_AdapterNative {
CXFA_FFDoc* CreateDoc(IXFA_DocProvider* pProvider, CPDF_Document* pPDFDoc);
IXFA_AppProvider* GetAppProvider() { return m_pProvider; }
void SetDefaultFontMgr(CXFA_DefFontMgr* pFontMgr);
- CXFA_FFMenuHandler* GetMenuHandler();
// IFWL_AdapterNative:
IFWL_AdapterWidgetMgr* GetWidgetMgr(
@@ -74,7 +72,6 @@ class CXFA_FFApp : public IFWL_AdapterNative {
CXFA_FWLAdapterWidgetMgr* m_pAdapterWidgetMgr;
IFWL_WidgetMgrDelegate* m_pWidgetMgrDelegate;
IFX_FontMgr* m_pFDEFontMgr;
- CXFA_FFMenuHandler* m_pMenuHandler;
CFWL_SDAdapterThreadMgr* m_pAdapterThreadMgr;
};
diff --git a/xfa/include/fxfa/xfa_ffdochandler.h b/xfa/include/fxfa/xfa_ffdochandler.h
index 7eaa20b4cc..6350d65079 100644
--- a/xfa/include/fxfa/xfa_ffdochandler.h
+++ b/xfa/include/fxfa/xfa_ffdochandler.h
@@ -16,31 +16,9 @@ class CXFA_FFDocHandler {
CXFA_FFDocHandler();
~CXFA_FFDocHandler();
- void ReleaseDoc(CXFA_FFDoc* hDoc);
- IXFA_DocProvider* GetDocProvider(CXFA_FFDoc* hDoc);
- uint32_t GetDocType(CXFA_FFDoc* hDoc);
- int32_t StartLoad(CXFA_FFDoc* hDoc);
- int32_t DoLoad(CXFA_FFDoc* hDoc, IFX_Pause* pPause = NULL);
- void StopLoad(CXFA_FFDoc* hDoc);
-
- CXFA_FFDocView* CreateDocView(CXFA_FFDoc* hDoc, uint32_t dwView = 0);
- int32_t CountPackages(CXFA_FFDoc* hDoc);
- void GetPackageName(CXFA_FFDoc* hDoc,
- int32_t iPackage,
- CFX_WideStringC& wsPackage);
- CFDE_XMLElement* GetPackageData(CXFA_FFDoc* hDoc,
- const CFX_WideStringC& wsPackage);
- FX_BOOL SavePackage(CXFA_FFDoc* hDoc,
- const CFX_WideStringC& wsPackage,
- IFX_FileWrite* pFile,
- CXFA_ChecksumContext* pCSContext = NULL);
- FX_BOOL CloseDoc(CXFA_FFDoc* hDoc);
- FX_BOOL ImportData(CXFA_FFDoc* hDoc,
- IFX_FileRead* pStream,
- FX_BOOL bXDP = TRUE);
- void SetJSERuntime(CXFA_FFDoc* hDoc, FXJSE_HRUNTIME hRuntime);
FXJSE_HVALUE GetXFAScriptObject(CXFA_FFDoc* hDoc);
XFA_ATTRIBUTEENUM GetRestoreState(CXFA_FFDoc* hDoc);
+
FX_BOOL RunDocScript(CXFA_FFDoc* hDoc,
XFA_SCRIPTTYPE eScriptType,
const CFX_WideStringC& wsScript,
diff --git a/xfa/include/fxfa/xfa_ffwidget.h b/xfa/include/fxfa/xfa_ffwidget.h
new file mode 100644
index 0000000000..70ac91931a
--- /dev/null
+++ b/xfa/include/fxfa/xfa_ffwidget.h
@@ -0,0 +1,185 @@
+// 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 XFA_INCLUDE_FXFA_XFA_FFWIDGET_H_
+#define XFA_INCLUDE_FXFA_XFA_FFWIDGET_H_
+
+#include <vector>
+
+#include "core/include/fxcodec/fx_codec_def.h"
+#include "core/include/fxge/fx_ge.h"
+#include "xfa/fxfa/parser/xfa_doclayout.h"
+#include "xfa/include/fxfa/fxfa.h"
+
+class CXFA_FFPageView;
+class CXFA_FFDocView;
+class CXFA_FFDoc;
+class CXFA_FFApp;
+
+inline FX_FLOAT XFA_UnitPx2Pt(FX_FLOAT fPx, FX_FLOAT fDpi) {
+ return fPx * 72.0f / fDpi;
+}
+#define XFA_FLOAT_PERCISION 0.001f
+enum XFA_WIDGETITEM {
+ XFA_WIDGETITEM_Parent,
+ XFA_WIDGETITEM_FirstChild,
+ XFA_WIDGETITEM_NextSibling,
+ XFA_WIDGETITEM_PrevSibling,
+};
+class CXFA_CalcData {
+ public:
+ CXFA_CalcData() : m_iRefCount(0) {}
+ ~CXFA_CalcData() { m_Globals.RemoveAll(); }
+ CFX_PtrArray m_Globals;
+ int32_t m_iRefCount;
+};
+class CXFA_FFWidget : public CFX_PrivateData, public CXFA_ContentLayoutItem {
+ public:
+ CXFA_FFWidget(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc);
+ virtual ~CXFA_FFWidget();
+ CXFA_FFPageView* GetPageView();
+ void SetPageView(CXFA_FFPageView* pPageView);
+ void GetWidgetRect(CFX_RectF& rtWidget);
+ CFX_RectF ReCacheWidgetRect();
+ uint32_t GetStatus();
+ void ModifyStatus(uint32_t dwAdded, uint32_t dwRemoved);
+ virtual FX_BOOL GetBBox(CFX_RectF& rtBox,
+ uint32_t dwStatus,
+ FX_BOOL bDrawFocus = FALSE);
+ CXFA_WidgetAcc* GetDataAcc();
+ FX_BOOL GetToolTip(CFX_WideString& wsToolTip);
+ virtual void RenderWidget(CFX_Graphics* pGS,
+ CFX_Matrix* pMatrix = NULL,
+ uint32_t dwStatus = 0,
+ int32_t iRotate = 0);
+
+ virtual FX_BOOL IsLoaded();
+ virtual FX_BOOL LoadWidget();
+ virtual void UnloadWidget();
+ virtual FX_BOOL PerformLayout();
+ virtual FX_BOOL UpdateFWLData();
+ virtual void UpdateWidgetProperty();
+ virtual FX_BOOL OnMouseEnter();
+ virtual FX_BOOL OnMouseExit();
+ virtual FX_BOOL OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy);
+ virtual FX_BOOL OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy);
+ virtual FX_BOOL OnLButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy);
+ virtual FX_BOOL OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy);
+ virtual FX_BOOL OnMouseWheel(uint32_t dwFlags,
+ int16_t zDelta,
+ FX_FLOAT fx,
+ FX_FLOAT fy);
+ virtual FX_BOOL OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy);
+ virtual FX_BOOL OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy);
+ virtual FX_BOOL OnRButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy);
+
+ virtual FX_BOOL OnSetFocus(CXFA_FFWidget* pOldWidget);
+ virtual FX_BOOL OnKillFocus(CXFA_FFWidget* pNewWidget);
+ virtual FX_BOOL OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags);
+ virtual FX_BOOL OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags);
+ virtual FX_BOOL OnChar(uint32_t dwChar, uint32_t dwFlags);
+ virtual uint32_t OnHitTest(FX_FLOAT fx, FX_FLOAT fy);
+ virtual FX_BOOL OnSetCursor(FX_FLOAT fx, FX_FLOAT fy);
+ virtual FX_BOOL CanUndo() { return FALSE; }
+ virtual FX_BOOL CanRedo() { return FALSE; }
+ virtual FX_BOOL Undo() { return FALSE; }
+ virtual FX_BOOL Redo() { return FALSE; }
+ virtual FX_BOOL CanCopy() { return FALSE; }
+ virtual FX_BOOL CanCut() { return FALSE; }
+ virtual FX_BOOL CanPaste() { return FALSE; }
+ virtual FX_BOOL CanSelectAll() { return FALSE; }
+ virtual FX_BOOL CanDelete() { return CanCut(); }
+ virtual FX_BOOL CanDeSelect() { return CanCopy(); }
+ virtual FX_BOOL Copy(CFX_WideString& wsCopy) { return FALSE; }
+ virtual FX_BOOL Cut(CFX_WideString& wsCut) { return FALSE; }
+ virtual FX_BOOL Paste(const CFX_WideString& wsPaste) { return FALSE; }
+ virtual FX_BOOL SelectAll() { return FALSE; }
+ virtual FX_BOOL Delete() { return FALSE; }
+ virtual FX_BOOL DeSelect() { return FALSE; }
+ virtual FX_BOOL GetSuggestWords(CFX_PointF pointf,
+ std::vector<CFX_ByteString>& sSuggest) {
+ return FALSE;
+ }
+ virtual FX_BOOL ReplaceSpellCheckWord(CFX_PointF pointf,
+ const CFX_ByteStringC& bsReplace) {
+ return FALSE;
+ }
+ CXFA_FFDocView* GetDocView();
+ void SetDocView(CXFA_FFDocView* pDocView) { m_pDocView = pDocView; }
+ CXFA_FFDoc* GetDoc();
+ CXFA_FFApp* GetApp();
+ IXFA_AppProvider* GetAppProvider();
+ void InvalidateWidget(const CFX_RectF* pRect = NULL);
+ void AddInvalidateRect(const CFX_RectF* pRect = NULL);
+ FX_BOOL GetCaptionText(CFX_WideString& wsCap);
+ FX_BOOL IsFocused();
+ void Rotate2Normal(FX_FLOAT& fx, FX_FLOAT& fy);
+ void GetRotateMatrix(CFX_Matrix& mt);
+ FX_BOOL IsLayoutRectEmpty();
+ CXFA_FFWidget* GetParent();
+ FX_BOOL IsAncestorOf(CXFA_FFWidget* pWidget);
+
+ protected:
+ virtual FX_BOOL PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy);
+ void DrawBorder(CFX_Graphics* pGS,
+ CXFA_Box box,
+ const CFX_RectF& rtBorder,
+ CFX_Matrix* pMatrix,
+ uint32_t dwFlags = 0);
+ void GetMinMaxWidth(FX_FLOAT fMinWidth, FX_FLOAT fMaxWidth);
+ void GetMinMaxHeight(FX_FLOAT fMinHeight, FX_FLOAT fMaxHeight);
+ void GetRectWithoutRotate(CFX_RectF& rtWidget);
+ FX_BOOL IsMatchVisibleStatus(uint32_t dwStatus);
+
+ void EventKillFocus();
+ FX_BOOL IsButtonDown();
+ void SetButtonDown(FX_BOOL bSet);
+ CXFA_FFDocView* m_pDocView;
+ CXFA_FFPageView* m_pPageView;
+ CXFA_WidgetAcc* m_pDataAcc;
+ CFX_RectF m_rtWidget;
+};
+int32_t XFA_StrokeTypeSetLineDash(CFX_Graphics* pGraphics,
+ int32_t iStrokeType,
+ int32_t iCapType);
+CFX_GraphStateData::LineCap XFA_LineCapToFXGE(int32_t iLineCap);
+void XFA_DrawImage(CFX_Graphics* pGS,
+ const CFX_RectF& rtImage,
+ CFX_Matrix* pMatrix,
+ CFX_DIBitmap* pDIBitmap,
+ int32_t iAspect,
+ int32_t iImageXDpi,
+ int32_t iImageYDpi,
+ int32_t iHorzAlign = XFA_ATTRIBUTEENUM_Left,
+ int32_t iVertAlign = XFA_ATTRIBUTEENUM_Top);
+CFX_DIBitmap* XFA_LoadImageData(CXFA_FFDoc* pDoc,
+ CXFA_Image* pImage,
+ FX_BOOL& bNameImage,
+ int32_t& iImageXDpi,
+ int32_t& iImageYDpi);
+CFX_DIBitmap* XFA_LoadImageFromBuffer(IFX_FileRead* pImageFileRead,
+ FXCODEC_IMAGE_TYPE type,
+ int32_t& iImageXDpi,
+ int32_t& iImageYDpi);
+FXCODEC_IMAGE_TYPE XFA_GetImageType(const CFX_WideStringC& wsType);
+FX_CHAR* XFA_Base64Encode(const uint8_t* buf, int32_t buf_len);
+void XFA_RectWidthoutMargin(CFX_RectF& rt,
+ const CXFA_Margin& mg,
+ FX_BOOL bUI = FALSE);
+FX_FLOAT XFA_GetEdgeThickness(const CXFA_StrokeArray& strokes,
+ FX_BOOL b3DStyle,
+ int32_t nIndex);
+CXFA_FFWidget* XFA_GetWidgetFromLayoutItem(CXFA_LayoutItem* pLayoutItem);
+FX_BOOL XFA_IsCreateWidget(XFA_ELEMENT iType);
+#define XFA_DRAWBOX_ForceRound 1
+#define XFA_DRAWBOX_Lowered3D 2
+void XFA_DrawBox(CXFA_Box box,
+ CFX_Graphics* pGS,
+ const CFX_RectF& rtWidget,
+ CFX_Matrix* pMatrix,
+ uint32_t dwFlags = 0);
+
+#endif // XFA_INCLUDE_FXFA_XFA_FFWIDGET_H_
diff --git a/xfa/include/fxfa/xfa_ffwidgethandler.h b/xfa/include/fxfa/xfa_ffwidgethandler.h
index 28c6b4b20b..5247208431 100644
--- a/xfa/include/fxfa/xfa_ffwidgethandler.h
+++ b/xfa/include/fxfa/xfa_ffwidgethandler.h
@@ -18,26 +18,11 @@ class CXFA_FFWidgetHandler {
public:
CXFA_FFWidgetHandler(CXFA_FFDocView* pDocView);
~CXFA_FFWidgetHandler();
+
CXFA_FFWidget* CreateWidget(CXFA_FFWidget* hParent,
XFA_WIDGETTYPE eType,
CXFA_FFWidget* hBefore = NULL);
- CXFA_FFPageView* GetPageView(CXFA_FFWidget* hWidget);
- void GetRect(CXFA_FFWidget* hWidget, CFX_RectF& rt);
- uint32_t GetStatus(CXFA_FFWidget* hWidget);
- FX_BOOL GetBBox(CXFA_FFWidget* hWidget,
- CFX_RectF& rtBox,
- uint32_t dwStatus,
- FX_BOOL bDrawFocus = FALSE);
- CXFA_WidgetAcc* GetDataAcc(CXFA_FFWidget* hWidget);
- void GetName(CXFA_FFWidget* hWidget,
- CFX_WideString& wsName,
- int32_t iNameType = 0);
- FX_BOOL GetToolTip(CXFA_FFWidget* hWidget, CFX_WideString& wsToolTip);
- void SetPrivateData(CXFA_FFWidget* hWidget,
- void* module_id,
- void* pData,
- PD_CALLBACK_FREEDATA callback);
- void* GetPrivateData(CXFA_FFWidget* hWidget, void* module_id);
+
FX_BOOL OnMouseEnter(CXFA_FFWidget* hWidget);
FX_BOOL OnMouseExit(CXFA_FFWidget* hWidget);
FX_BOOL OnLButtonDown(CXFA_FFWidget* hWidget,
@@ -139,33 +124,4 @@ class CXFA_FFWidgetHandler {
CXFA_FFDocView* m_pDocView;
};
-class CXFA_FFMenuHandler {
- public:
- CXFA_FFMenuHandler();
- ~CXFA_FFMenuHandler();
-
- FX_BOOL CanCopy(CXFA_FFWidget* hWidget);
- FX_BOOL CanCut(CXFA_FFWidget* hWidget);
- FX_BOOL CanPaste(CXFA_FFWidget* hWidget);
- FX_BOOL CanSelectAll(CXFA_FFWidget* hWidget);
- FX_BOOL CanDelete(CXFA_FFWidget* hWidget);
- FX_BOOL CanDeSelect(CXFA_FFWidget* hWidget);
- FX_BOOL Copy(CXFA_FFWidget* hWidget, CFX_WideString& wsText);
- FX_BOOL Cut(CXFA_FFWidget* hWidget, CFX_WideString& wsText);
- FX_BOOL Paste(CXFA_FFWidget* hWidget, const CFX_WideString& wsText);
- FX_BOOL SelectAll(CXFA_FFWidget* hWidget);
- FX_BOOL Delete(CXFA_FFWidget* hWidget);
- FX_BOOL DeSelect(CXFA_FFWidget* hWidget);
- FX_BOOL CanUndo(CXFA_FFWidget* hWidget);
- FX_BOOL CanRedo(CXFA_FFWidget* hWidget);
- FX_BOOL Undo(CXFA_FFWidget* hWidget);
- FX_BOOL Redo(CXFA_FFWidget* hWidget);
- FX_BOOL GetSuggestWords(CXFA_FFWidget* hWidget,
- CFX_PointF pointf,
- std::vector<CFX_ByteString>& sSuggest);
- FX_BOOL ReplaceSpellCheckWord(CXFA_FFWidget* hWidget,
- CFX_PointF pointf,
- const CFX_ByteStringC& bsReplace);
-};
-
#endif // XFA_INCLUDE_FXFA_XFA_FFWIDGETHANDLER_H_