diff options
author | dsinclair <dsinclair@chromium.org> | 2016-04-04 12:08:40 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-04 12:08:40 -0700 |
commit | 221caf6f6f9810cbc0e0c4c50af9b036a052ae13 (patch) | |
tree | cbccfb1bd8b48387753c45604f0f85e52c48aa07 /xfa/fxfa | |
parent | 6e56a5ebc88e05fe0bf05624eba9aeed57fa6d60 (diff) | |
download | pdfium-221caf6f6f9810cbc0e0c4c50af9b036a052ae13.tar.xz |
Cleanup the FF Handler proxy methods.
This CL removes the proxy methods from CXFA_FFWidgetHandler and CXFA_DocHandler
and removes CXFA_FFMenuHandler as it was only proxy methods.
The calls are made directly on the object now.
Review URL: https://codereview.chromium.org/1857893002
Diffstat (limited to 'xfa/fxfa')
30 files changed, 131 insertions, 445 deletions
diff --git a/xfa/fxfa/app/xfa_ffapp.cpp b/xfa/fxfa/app/xfa_ffapp.cpp index 4d3d707998..f629e408c0 100644 --- a/xfa/fxfa/app/xfa_ffapp.cpp +++ b/xfa/fxfa/app/xfa_ffapp.cpp @@ -73,7 +73,6 @@ CXFA_FFApp::CXFA_FFApp(IXFA_AppProvider* pProvider) m_pAdapterWidgetMgr(nullptr), m_pWidgetMgrDelegate(nullptr), m_pFDEFontMgr(nullptr), - m_pMenuHandler(nullptr), m_pAdapterThreadMgr(nullptr) { m_pFWLApp = IFWL_App::Create(this); FWL_SetApp(m_pFWLApp); @@ -91,7 +90,7 @@ CXFA_FFApp::~CXFA_FFApp() { m_pFWLTheme->Release(); delete m_pAdapterWidgetMgr; delete m_pAdapterThreadMgr; - delete m_pMenuHandler; + CXFA_TimeZoneProvider::Destroy(); delete m_pFontMgr; #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ @@ -101,12 +100,7 @@ CXFA_FFApp::~CXFA_FFApp() { if (m_pFDEFontMgr) m_pFDEFontMgr->Release(); } -CXFA_FFMenuHandler* CXFA_FFApp::GetMenuHandler() { - if (!m_pMenuHandler) { - m_pMenuHandler = new CXFA_FFMenuHandler; - } - return m_pMenuHandler; -} + CXFA_FFDocHandler* CXFA_FFApp::GetDocHandler() { if (!m_pDocHandler) { m_pDocHandler = new CXFA_FFDocHandler; diff --git a/xfa/fxfa/app/xfa_ffbarcode.cpp b/xfa/fxfa/app/xfa_ffbarcode.cpp index 80def6c334..b7178f0baa 100644 --- a/xfa/fxfa/app/xfa_ffbarcode.cpp +++ b/xfa/fxfa/app/xfa_ffbarcode.cpp @@ -12,9 +12,9 @@ #include "xfa/fwl/lightwidget/cfwl_barcode.h" #include "xfa/fxfa/app/xfa_fffield.h" #include "xfa/fxfa/app/xfa_fftextedit.h" -#include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxfa/app/xfa_fwladapter.h" #include "xfa/include/fxfa/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffwidget.h" namespace { diff --git a/xfa/fxfa/app/xfa_ffcheckbutton.cpp b/xfa/fxfa/app/xfa_ffcheckbutton.cpp index 0e56ca612c..f741f2598e 100644 --- a/xfa/fxfa/app/xfa_ffcheckbutton.cpp +++ b/xfa/fxfa/app/xfa_ffcheckbutton.cpp @@ -12,11 +12,11 @@ #include "xfa/fwl/lightwidget/cfwl_checkbox.h" #include "xfa/fxfa/app/xfa_ffexclgroup.h" #include "xfa/fxfa/app/xfa_fffield.h" -#include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/include/fxfa/xfa_ffapp.h" #include "xfa/include/fxfa/xfa_ffdoc.h" #include "xfa/include/fxfa/xfa_ffdocview.h" #include "xfa/include/fxfa/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffwidget.h" CXFA_FFCheckButton::CXFA_FFCheckButton(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) diff --git a/xfa/fxfa/app/xfa_ffchoicelist.cpp b/xfa/fxfa/app/xfa_ffchoicelist.cpp index bba1a7ec64..44ae14264d 100644 --- a/xfa/fxfa/app/xfa_ffchoicelist.cpp +++ b/xfa/fxfa/app/xfa_ffchoicelist.cpp @@ -12,11 +12,11 @@ #include "xfa/fwl/lightwidget/cfwl_combobox.h" #include "xfa/fwl/lightwidget/cfwl_listbox.h" #include "xfa/fxfa/app/xfa_fffield.h" -#include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxfa/app/xfa_fwladapter.h" #include "xfa/include/fxfa/xfa_ffdoc.h" #include "xfa/include/fxfa/xfa_ffdocview.h" #include "xfa/include/fxfa/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffwidget.h" CXFA_FFListBox::CXFA_FFListBox(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp index ed4f94cd77..ce27428b40 100644 --- a/xfa/fxfa/app/xfa_ffdoc.cpp +++ b/xfa/fxfa/app/xfa_ffdoc.cpp @@ -15,7 +15,6 @@ #include "xfa/fgas/crt/fgas_algorithm.h" #include "xfa/fwl/core/ifwl_notedriver.h" #include "xfa/fxfa/app/xfa_ffnotify.h" -#include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxfa/parser/xfa_docdata.h" #include "xfa/fxfa/parser/xfa_document_serialize.h" #include "xfa/fxfa/parser/xfa_parser.h" @@ -24,6 +23,7 @@ #include "xfa/include/fxfa/xfa_checksum.h" #include "xfa/include/fxfa/xfa_ffapp.h" #include "xfa/include/fxfa/xfa_ffdocview.h" +#include "xfa/include/fxfa/xfa_ffwidget.h" #include "xfa/include/fxfa/xfa_fontmgr.h" CXFA_FFDoc::CXFA_FFDoc(CXFA_FFApp* pApp, IXFA_DocProvider* pDocProvider) diff --git a/xfa/fxfa/app/xfa_ffdochandler.cpp b/xfa/fxfa/app/xfa_ffdochandler.cpp index 949dae4a8b..6aed551fdb 100644 --- a/xfa/fxfa/app/xfa_ffdochandler.cpp +++ b/xfa/fxfa/app/xfa_ffdochandler.cpp @@ -15,100 +15,47 @@ CXFA_FFDocHandler::CXFA_FFDocHandler() {} CXFA_FFDocHandler::~CXFA_FFDocHandler() {} -void CXFA_FFDocHandler::ReleaseDoc(CXFA_FFDoc* hDoc) { - delete hDoc; // virtual dtor. -} -IXFA_DocProvider* CXFA_FFDocHandler::GetDocProvider(CXFA_FFDoc* hDoc) { - return hDoc->GetDocProvider(); -} -uint32_t CXFA_FFDocHandler::GetDocType(CXFA_FFDoc* hDoc) { - return hDoc->GetDocType(); -} -int32_t CXFA_FFDocHandler::StartLoad(CXFA_FFDoc* hDoc) { - return hDoc->StartLoad(); -} -int32_t CXFA_FFDocHandler::DoLoad(CXFA_FFDoc* hDoc, IFX_Pause* pPause) { - return hDoc->DoLoad(pPause); -} -void CXFA_FFDocHandler::StopLoad(CXFA_FFDoc* hDoc) { - hDoc->StopLoad(); -} - -CXFA_FFDocView* CXFA_FFDocHandler::CreateDocView(CXFA_FFDoc* hDoc, - uint32_t dwView) { - return hDoc->CreateDocView(dwView); -} -int32_t CXFA_FFDocHandler::CountPackages(CXFA_FFDoc* hDoc) { - return 0; -} -void CXFA_FFDocHandler::GetPackageName(CXFA_FFDoc* hDoc, - int32_t iPackage, - CFX_WideStringC& wsPackage) {} -CFDE_XMLElement* CXFA_FFDocHandler::GetPackageData( - CXFA_FFDoc* hDoc, - const CFX_WideStringC& wsPackage) { - return hDoc->GetPackageData(wsPackage); -} -FX_BOOL CXFA_FFDocHandler::SavePackage(CXFA_FFDoc* hDoc, - const CFX_WideStringC& wsPackage, - IFX_FileWrite* pFile, - CXFA_ChecksumContext* pCSContext) { - return hDoc->SavePackage(wsPackage, pFile, pCSContext); -} -FX_BOOL CXFA_FFDocHandler::CloseDoc(CXFA_FFDoc* hDoc) { - return hDoc->CloseDoc(); -} - -FX_BOOL CXFA_FFDocHandler::ImportData(CXFA_FFDoc* hDoc, - IFX_FileRead* pStream, - FX_BOOL bXDP) { - return hDoc->ImportData(pStream, bXDP); -} -void CXFA_FFDocHandler::SetJSERuntime(CXFA_FFDoc* hDoc, - FXJSE_HRUNTIME hRuntime) { - hDoc->GetXFADoc()->InitScriptContext(hRuntime); -} FXJSE_HVALUE CXFA_FFDocHandler::GetXFAScriptObject(CXFA_FFDoc* hDoc) { CXFA_Document* pXFADoc = hDoc->GetXFADoc(); - if (!pXFADoc) { - return NULL; - } + if (!pXFADoc) + return nullptr; + CXFA_ScriptContext* pScriptContext = pXFADoc->GetScriptContext(); - if (!pScriptContext) { - return NULL; - } + if (!pScriptContext) + return nullptr; return pScriptContext->GetJSValueFromMap(pXFADoc->GetRoot()); } + XFA_ATTRIBUTEENUM CXFA_FFDocHandler::GetRestoreState(CXFA_FFDoc* hDoc) { CXFA_Document* pXFADoc = hDoc->GetXFADoc(); - if (!pXFADoc) { + if (!pXFADoc) return XFA_ATTRIBUTEENUM_Unknown; - } + CXFA_Node* pForm = ToNode(pXFADoc->GetXFAObject(XFA_HASHCODE_Form)); - if (!pForm) { + if (!pForm) return XFA_ATTRIBUTEENUM_Unknown; - } + CXFA_Node* pSubForm = pForm->GetFirstChildByClass(XFA_ELEMENT_Subform); - if (!pSubForm) { + if (!pSubForm) return XFA_ATTRIBUTEENUM_Unknown; - } return pSubForm->GetEnum(XFA_ATTRIBUTE_RestoreState); } + FX_BOOL CXFA_FFDocHandler::RunDocScript(CXFA_FFDoc* hDoc, XFA_SCRIPTTYPE eScriptType, const CFX_WideStringC& wsScript, FXJSE_HVALUE hRetValue, FXJSE_HVALUE hThisObject) { CXFA_Document* pXFADoc = hDoc->GetXFADoc(); - if (!pXFADoc) { + if (!pXFADoc) return FALSE; - } + CXFA_ScriptContext* pScriptContext = pXFADoc->GetScriptContext(); - if (!pScriptContext) { + if (!pScriptContext) return FALSE; - } + return pScriptContext->RunScript( (XFA_SCRIPTLANGTYPE)eScriptType, wsScript, hRetValue, - hThisObject ? (CXFA_Object*)FXJSE_Value_ToObject(hThisObject, NULL) - : NULL); + hThisObject ? (CXFA_Object*)FXJSE_Value_ToObject(hThisObject, nullptr) + : nullptr); } diff --git a/xfa/fxfa/app/xfa_ffdocview.cpp b/xfa/fxfa/app/xfa_ffdocview.cpp index 907e2b5d22..5e8813542d 100644 --- a/xfa/fxfa/app/xfa_ffdocview.cpp +++ b/xfa/fxfa/app/xfa_ffdocview.cpp @@ -21,7 +21,6 @@ #include "xfa/fxfa/app/xfa_ffsubform.h" #include "xfa/fxfa/app/xfa_fftext.h" #include "xfa/fxfa/app/xfa_fftextedit.h" -#include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxfa/app/xfa_ffwidgetacc.h" #include "xfa/fxfa/app/xfa_fwladapter.h" #include "xfa/fxfa/app/xfa_textlayout.h" @@ -31,6 +30,7 @@ #include "xfa/include/fxfa/xfa_ffapp.h" #include "xfa/include/fxfa/xfa_ffdoc.h" #include "xfa/include/fxfa/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffwidget.h" #include "xfa/include/fxfa/xfa_ffwidgethandler.h" extern const XFA_ATTRIBUTEENUM gs_EventActivity[] = { diff --git a/xfa/fxfa/app/xfa_ffdraw.cpp b/xfa/fxfa/app/xfa_ffdraw.cpp index 06fc85b893..68c1d96f4a 100644 --- a/xfa/fxfa/app/xfa_ffdraw.cpp +++ b/xfa/fxfa/app/xfa_ffdraw.cpp @@ -6,10 +6,10 @@ #include "xfa/fxfa/app/xfa_ffdraw.h" -#include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/include/fxfa/xfa_ffapp.h" #include "xfa/include/fxfa/xfa_ffdoc.h" #include "xfa/include/fxfa/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffwidget.h" CXFA_FFDraw::CXFA_FFDraw(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) : CXFA_FFWidget(pPageView, pDataAcc) {} diff --git a/xfa/fxfa/app/xfa_ffdraw.h b/xfa/fxfa/app/xfa_ffdraw.h index fb2d11e1f6..52ceb2cd0c 100644 --- a/xfa/fxfa/app/xfa_ffdraw.h +++ b/xfa/fxfa/app/xfa_ffdraw.h @@ -7,8 +7,8 @@ #ifndef XFA_FXFA_APP_XFA_FFDRAW_H_ #define XFA_FXFA_APP_XFA_FFDRAW_H_ -#include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/include/fxfa/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffwidget.h" class CXFA_FFDraw : public CXFA_FFWidget { public: diff --git a/xfa/fxfa/app/xfa_ffexclgroup.cpp b/xfa/fxfa/app/xfa_ffexclgroup.cpp index 47cc455962..177738d636 100644 --- a/xfa/fxfa/app/xfa_ffexclgroup.cpp +++ b/xfa/fxfa/app/xfa_ffexclgroup.cpp @@ -6,10 +6,10 @@ #include "xfa/fxfa/app/xfa_ffexclgroup.h" -#include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/include/fxfa/xfa_ffapp.h" #include "xfa/include/fxfa/xfa_ffdoc.h" #include "xfa/include/fxfa/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffwidget.h" CXFA_FFExclGroup::CXFA_FFExclGroup(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) diff --git a/xfa/fxfa/app/xfa_ffexclgroup.h b/xfa/fxfa/app/xfa_ffexclgroup.h index e492cf1817..5a1fc945b7 100644 --- a/xfa/fxfa/app/xfa_ffexclgroup.h +++ b/xfa/fxfa/app/xfa_ffexclgroup.h @@ -7,8 +7,8 @@ #ifndef XFA_FXFA_APP_XFA_FFEXCLGROUP_H_ #define XFA_FXFA_APP_XFA_FFEXCLGROUP_H_ -#include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/include/fxfa/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffwidget.h" class CXFA_FFExclGroup : public CXFA_FFWidget { public: diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp index 90bb5f39e5..a0f64e9bb0 100644 --- a/xfa/fxfa/app/xfa_fffield.cpp +++ b/xfa/fxfa/app/xfa_fffield.cpp @@ -11,7 +11,6 @@ #include "xfa/fwl/core/ifwl_widgetmgrdelegate.h" #include "xfa/fwl/lightwidget/cfwl_edit.h" #include "xfa/fwl/lightwidget/cfwl_picturebox.h" -#include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxfa/app/xfa_fwltheme.h" #include "xfa/fxfa/app/xfa_textlayout.h" #include "xfa/fxgraphics/cfx_color.h" @@ -20,6 +19,7 @@ #include "xfa/include/fxfa/xfa_ffdoc.h" #include "xfa/include/fxfa/xfa_ffdocview.h" #include "xfa/include/fxfa/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffwidget.h" CXFA_FFField::CXFA_FFField(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) : CXFA_FFWidget(pPageView, pDataAcc), m_pNormalWidget(NULL) { diff --git a/xfa/fxfa/app/xfa_fffield.h b/xfa/fxfa/app/xfa_fffield.h index 51fe56be09..44ee9bb4f2 100644 --- a/xfa/fxfa/app/xfa_fffield.h +++ b/xfa/fxfa/app/xfa_fffield.h @@ -10,8 +10,8 @@ #include "xfa/fwl/core/fwl_sdadapterimp.h" #include "xfa/fwl/core/ifwl_widgetdelegate.h" #include "xfa/fwl/lightwidget/cfwl_widget.h" -#include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/include/fxfa/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffwidget.h" #define XFA_MINUI_HEIGHT 4.32f #define XFA_DEFAULTUI_HEIGHT 2.0f diff --git a/xfa/fxfa/app/xfa_ffimage.cpp b/xfa/fxfa/app/xfa_ffimage.cpp index f7f6ebbf1b..5c28682978 100644 --- a/xfa/fxfa/app/xfa_ffimage.cpp +++ b/xfa/fxfa/app/xfa_ffimage.cpp @@ -7,10 +7,10 @@ #include "xfa/fxfa/app/xfa_ffimage.h" #include "xfa/fxfa/app/xfa_ffdraw.h" -#include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/include/fxfa/xfa_ffapp.h" #include "xfa/include/fxfa/xfa_ffdoc.h" #include "xfa/include/fxfa/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffwidget.h" CXFA_FFImage::CXFA_FFImage(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) : CXFA_FFDraw(pPageView, pDataAcc) {} diff --git a/xfa/fxfa/app/xfa_ffimageedit.cpp b/xfa/fxfa/app/xfa_ffimageedit.cpp index ba16d4d352..ce69b1242b 100644 --- a/xfa/fxfa/app/xfa_ffimageedit.cpp +++ b/xfa/fxfa/app/xfa_ffimageedit.cpp @@ -11,10 +11,10 @@ #include "xfa/fwl/core/ifwl_notedriver.h" #include "xfa/fwl/lightwidget/cfwl_picturebox.h" #include "xfa/fxfa/app/xfa_fffield.h" -#include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/include/fxfa/xfa_ffdoc.h" #include "xfa/include/fxfa/xfa_ffdocview.h" #include "xfa/include/fxfa/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffwidget.h" CXFA_FFImageEdit::CXFA_FFImageEdit(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) diff --git a/xfa/fxfa/app/xfa_ffnotify.cpp b/xfa/fxfa/app/xfa_ffnotify.cpp index 7cb9f40b63..7851819474 100644 --- a/xfa/fxfa/app/xfa_ffnotify.cpp +++ b/xfa/fxfa/app/xfa_ffnotify.cpp @@ -20,7 +20,6 @@ #include "xfa/fxfa/app/xfa_ffsubform.h" #include "xfa/fxfa/app/xfa_fftext.h" #include "xfa/fxfa/app/xfa_fftextedit.h" -#include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxfa/app/xfa_ffwidgetacc.h" #include "xfa/fxfa/app/xfa_fwladapter.h" #include "xfa/fxfa/app/xfa_textlayout.h" @@ -28,6 +27,7 @@ #include "xfa/include/fxfa/xfa_ffdoc.h" #include "xfa/include/fxfa/xfa_ffdocview.h" #include "xfa/include/fxfa/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffwidget.h" #include "xfa/include/fxfa/xfa_ffwidgethandler.h" static void XFA_FFDeleteWidgetAcc(void* pData) { diff --git a/xfa/fxfa/app/xfa_ffpageview.cpp b/xfa/fxfa/app/xfa_ffpageview.cpp index 584832ed2c..e22ddc0394 100644 --- a/xfa/fxfa/app/xfa_ffpageview.cpp +++ b/xfa/fxfa/app/xfa_ffpageview.cpp @@ -13,10 +13,10 @@ #include "xfa/fxfa/app/xfa_ffimageedit.h" #include "xfa/fxfa/app/xfa_ffpushbutton.h" #include "xfa/fxfa/app/xfa_fftextedit.h" -#include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxfa/app/xfa_fwladapter.h" #include "xfa/include/fxfa/xfa_ffdoc.h" #include "xfa/include/fxfa/xfa_ffdocview.h" +#include "xfa/include/fxfa/xfa_ffwidget.h" CXFA_FFPageView::CXFA_FFPageView(CXFA_FFDocView* pDocView, CXFA_Node* pPageArea) : CXFA_ContainerLayoutItem(pPageArea), diff --git a/xfa/fxfa/app/xfa_ffpath.cpp b/xfa/fxfa/app/xfa_ffpath.cpp index eddc41f471..6f30612942 100644 --- a/xfa/fxfa/app/xfa_ffpath.cpp +++ b/xfa/fxfa/app/xfa_ffpath.cpp @@ -7,12 +7,12 @@ #include "xfa/fxfa/app/xfa_ffpath.h" #include "xfa/fxfa/app/xfa_ffdraw.h" -#include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxgraphics/cfx_color.h" #include "xfa/fxgraphics/cfx_path.h" #include "xfa/include/fxfa/xfa_ffapp.h" #include "xfa/include/fxfa/xfa_ffdoc.h" #include "xfa/include/fxfa/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffwidget.h" CXFA_FFLine::CXFA_FFLine(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) : CXFA_FFDraw(pPageView, pDataAcc) {} diff --git a/xfa/fxfa/app/xfa_ffpushbutton.cpp b/xfa/fxfa/app/xfa_ffpushbutton.cpp index 85843755b6..4c54868f55 100644 --- a/xfa/fxfa/app/xfa_ffpushbutton.cpp +++ b/xfa/fxfa/app/xfa_ffpushbutton.cpp @@ -10,13 +10,13 @@ #include "xfa/fwl/core/ifwl_widgetmgrdelegate.h" #include "xfa/fwl/lightwidget/cfwl_pushbutton.h" #include "xfa/fxfa/app/xfa_fffield.h" -#include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxfa/app/xfa_ffwidgetacc.h" #include "xfa/fxfa/app/xfa_textlayout.h" #include "xfa/fxgraphics/cfx_color.h" #include "xfa/fxgraphics/cfx_path.h" #include "xfa/include/fxfa/xfa_ffapp.h" #include "xfa/include/fxfa/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffwidget.h" CXFA_FFPushButton::CXFA_FFPushButton(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) diff --git a/xfa/fxfa/app/xfa_ffsignature.cpp b/xfa/fxfa/app/xfa_ffsignature.cpp index 65a7be2f5c..e5dba34985 100644 --- a/xfa/fxfa/app/xfa_ffsignature.cpp +++ b/xfa/fxfa/app/xfa_ffsignature.cpp @@ -7,9 +7,9 @@ #include "xfa/fxfa/app/xfa_ffsignature.h" #include "xfa/fxfa/app/xfa_fffield.h" -#include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/include/fxfa/xfa_ffdoc.h" #include "xfa/include/fxfa/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffwidget.h" CXFA_FFSignature::CXFA_FFSignature(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) diff --git a/xfa/fxfa/app/xfa_ffsubform.cpp b/xfa/fxfa/app/xfa_ffsubform.cpp index fd718f8158..0ba4858b72 100644 --- a/xfa/fxfa/app/xfa_ffsubform.cpp +++ b/xfa/fxfa/app/xfa_ffsubform.cpp @@ -6,10 +6,10 @@ #include "xfa/fxfa/app/xfa_ffsubform.h" -#include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/include/fxfa/xfa_ffapp.h" #include "xfa/include/fxfa/xfa_ffdoc.h" #include "xfa/include/fxfa/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffwidget.h" CXFA_FFSubForm::CXFA_FFSubForm(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) diff --git a/xfa/fxfa/app/xfa_ffsubform.h b/xfa/fxfa/app/xfa_ffsubform.h index bae6df6ee4..5a705a6a00 100644 --- a/xfa/fxfa/app/xfa_ffsubform.h +++ b/xfa/fxfa/app/xfa_ffsubform.h @@ -7,8 +7,8 @@ #ifndef XFA_FXFA_APP_XFA_FFSUBFORM_H_ #define XFA_FXFA_APP_XFA_FFSUBFORM_H_ -#include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/include/fxfa/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffwidget.h" class CXFA_FFSubForm : public CXFA_FFWidget { public: diff --git a/xfa/fxfa/app/xfa_fftext.cpp b/xfa/fxfa/app/xfa_fftext.cpp index d93c23fcec..d4bce5419f 100644 --- a/xfa/fxfa/app/xfa_fftext.cpp +++ b/xfa/fxfa/app/xfa_fftext.cpp @@ -8,12 +8,12 @@ #include "xfa/fwl/core/fwl_widgetdef.h" #include "xfa/fxfa/app/xfa_ffdraw.h" -#include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxfa/app/xfa_textlayout.h" #include "xfa/fxgraphics/include/cfx_graphics.h" #include "xfa/include/fxfa/xfa_ffapp.h" #include "xfa/include/fxfa/xfa_ffdoc.h" #include "xfa/include/fxfa/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffwidget.h" CXFA_FFText::CXFA_FFText(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) : CXFA_FFDraw(pPageView, pDataAcc) {} diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp index e11585fab0..085ec07d9f 100644 --- a/xfa/fxfa/app/xfa_fftextedit.cpp +++ b/xfa/fxfa/app/xfa_fftextedit.cpp @@ -15,7 +15,6 @@ #include "xfa/fwl/lightwidget/cfwl_datetimepicker.h" #include "xfa/fwl/lightwidget/cfwl_edit.h" #include "xfa/fxfa/app/xfa_fffield.h" -#include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxfa/app/xfa_fwladapter.h" #include "xfa/fxfa/app/xfa_textlayout.h" #include "xfa/fxfa/parser/xfa_localevalue.h" @@ -23,6 +22,7 @@ #include "xfa/include/fxfa/xfa_ffdoc.h" #include "xfa/include/fxfa/xfa_ffdocview.h" #include "xfa/include/fxfa/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffwidget.h" CXFA_FFTextEdit::CXFA_FFTextEdit(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp index 4bf5de56c7..241bae0fdf 100644 --- a/xfa/fxfa/app/xfa_ffwidget.cpp +++ b/xfa/fxfa/app/xfa_ffwidget.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxfa/app/xfa_ffwidget.h" +#include "xfa/include/fxfa/xfa_ffwidget.h" #include <algorithm> diff --git a/xfa/fxfa/app/xfa_ffwidget.h b/xfa/fxfa/app/xfa_ffwidget.h deleted file mode 100644 index 84ab926a39..0000000000 --- a/xfa/fxfa/app/xfa_ffwidget.h +++ /dev/null @@ -1,185 +0,0 @@ -// 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_FXFA_APP_XFA_FFWIDGET_H_ -#define XFA_FXFA_APP_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_FXFA_APP_XFA_FFWIDGET_H_ diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp index 5c2e6c354b..271f9261f0 100644 --- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp +++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp @@ -13,7 +13,6 @@ #include "xfa/fxfa/app/xfa_ffcheckbutton.h" #include "xfa/fxfa/app/xfa_ffchoicelist.h" #include "xfa/fxfa/app/xfa_fffield.h" -#include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxfa/app/xfa_fwladapter.h" #include "xfa/fxfa/app/xfa_textlayout.h" #include "xfa/fxfa/parser/xfa_document_layout_imp.h" @@ -24,6 +23,7 @@ #include "xfa/include/fxfa/xfa_ffdoc.h" #include "xfa/include/fxfa/xfa_ffdocview.h" #include "xfa/include/fxfa/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffwidget.h" #include "xfa/include/fxfa/xfa_fontmgr.h" static void XFA_FFDeleteCalcData(void* pData) { diff --git a/xfa/fxfa/app/xfa_ffwidgethandler.cpp b/xfa/fxfa/app/xfa_ffwidgethandler.cpp index 711d29abc2..b79082965a 100644 --- a/xfa/fxfa/app/xfa_ffwidgethandler.cpp +++ b/xfa/fxfa/app/xfa_ffwidgethandler.cpp @@ -10,56 +10,19 @@ #include "xfa/fxfa/app/xfa_ffchoicelist.h" #include "xfa/fxfa/app/xfa_fffield.h" -#include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxfa/app/xfa_fwladapter.h" #include "xfa/fxfa/parser/xfa_document_layout_imp.h" #include "xfa/fxfa/parser/xfa_parser.h" #include "xfa/fxfa/parser/xfa_parser_imp.h" #include "xfa/include/fxfa/xfa_ffdoc.h" #include "xfa/include/fxfa/xfa_ffdocview.h" +#include "xfa/include/fxfa/xfa_ffwidget.h" CXFA_FFWidgetHandler::CXFA_FFWidgetHandler(CXFA_FFDocView* pDocView) : m_pDocView(pDocView) {} CXFA_FFWidgetHandler::~CXFA_FFWidgetHandler() {} -CXFA_FFPageView* CXFA_FFWidgetHandler::GetPageView(CXFA_FFWidget* hWidget) { - return hWidget->GetPageView(); -} -void CXFA_FFWidgetHandler::GetRect(CXFA_FFWidget* hWidget, CFX_RectF& rt) { - hWidget->GetWidgetRect(rt); -} -uint32_t CXFA_FFWidgetHandler::GetStatus(CXFA_FFWidget* hWidget) { - return hWidget->GetStatus(); -} -FX_BOOL CXFA_FFWidgetHandler::GetBBox(CXFA_FFWidget* hWidget, - CFX_RectF& rtBox, - uint32_t dwStatus, - FX_BOOL bDrawFocus) { - return hWidget->GetBBox(rtBox, dwStatus, bDrawFocus); -} -CXFA_WidgetAcc* CXFA_FFWidgetHandler::GetDataAcc(CXFA_FFWidget* hWidget) { - return hWidget->GetDataAcc(); -} -void CXFA_FFWidgetHandler::GetName(CXFA_FFWidget* hWidget, - CFX_WideString& wsName, - int32_t iNameType) { - hWidget->GetDataAcc()->GetName(wsName, iNameType); -} -FX_BOOL CXFA_FFWidgetHandler::GetToolTip(CXFA_FFWidget* hWidget, - CFX_WideString& wsToolTip) { - return hWidget->GetToolTip(wsToolTip); -} -void CXFA_FFWidgetHandler::SetPrivateData(CXFA_FFWidget* hWidget, - void* module_id, - void* pData, - PD_CALLBACK_FREEDATA callback) { - hWidget->SetPrivateData(module_id, pData, callback); -} -void* CXFA_FFWidgetHandler::GetPrivateData(CXFA_FFWidget* hWidget, - void* module_id) { - return hWidget->GetPrivateData(module_id); -} FX_BOOL CXFA_FFWidgetHandler::OnMouseEnter(CXFA_FFWidget* hWidget) { m_pDocView->LockUpdate(); FX_BOOL bRet = hWidget->OnMouseEnter(); @@ -67,6 +30,7 @@ FX_BOOL CXFA_FFWidgetHandler::OnMouseEnter(CXFA_FFWidget* hWidget) { m_pDocView->UpdateDocView(); return bRet; } + FX_BOOL CXFA_FFWidgetHandler::OnMouseExit(CXFA_FFWidget* hWidget) { m_pDocView->LockUpdate(); FX_BOOL bRet = hWidget->OnMouseExit(); @@ -74,6 +38,7 @@ FX_BOOL CXFA_FFWidgetHandler::OnMouseExit(CXFA_FFWidget* hWidget) { m_pDocView->UpdateDocView(); return bRet; } + FX_BOOL CXFA_FFWidgetHandler::OnLButtonDown(CXFA_FFWidget* hWidget, uint32_t dwFlags, FX_FLOAT fx, @@ -90,6 +55,7 @@ FX_BOOL CXFA_FFWidgetHandler::OnLButtonDown(CXFA_FFWidget* hWidget, m_pDocView->UpdateDocView(); return bRet; } + FX_BOOL CXFA_FFWidgetHandler::OnLButtonUp(CXFA_FFWidget* hWidget, uint32_t dwFlags, FX_FLOAT fx, @@ -102,6 +68,7 @@ FX_BOOL CXFA_FFWidgetHandler::OnLButtonUp(CXFA_FFWidget* hWidget, m_pDocView->UpdateDocView(); return bRet; } + FX_BOOL CXFA_FFWidgetHandler::OnLButtonDblClk(CXFA_FFWidget* hWidget, uint32_t dwFlags, FX_FLOAT fx, @@ -111,6 +78,7 @@ FX_BOOL CXFA_FFWidgetHandler::OnLButtonDblClk(CXFA_FFWidget* hWidget, m_pDocView->RunInvalidate(); return bRet; } + FX_BOOL CXFA_FFWidgetHandler::OnMouseMove(CXFA_FFWidget* hWidget, uint32_t dwFlags, FX_FLOAT fx, @@ -120,6 +88,7 @@ FX_BOOL CXFA_FFWidgetHandler::OnMouseMove(CXFA_FFWidget* hWidget, m_pDocView->RunInvalidate(); return bRet; } + FX_BOOL CXFA_FFWidgetHandler::OnMouseWheel(CXFA_FFWidget* hWidget, uint32_t dwFlags, int16_t zDelta, @@ -130,6 +99,7 @@ FX_BOOL CXFA_FFWidgetHandler::OnMouseWheel(CXFA_FFWidget* hWidget, m_pDocView->RunInvalidate(); return bRet; } + FX_BOOL CXFA_FFWidgetHandler::OnRButtonDown(CXFA_FFWidget* hWidget, uint32_t dwFlags, FX_FLOAT fx, @@ -144,6 +114,7 @@ FX_BOOL CXFA_FFWidgetHandler::OnRButtonDown(CXFA_FFWidget* hWidget, m_pDocView->RunInvalidate(); return bRet; } + FX_BOOL CXFA_FFWidgetHandler::OnRButtonUp(CXFA_FFWidget* hWidget, uint32_t dwFlags, FX_FLOAT fx, @@ -153,6 +124,7 @@ FX_BOOL CXFA_FFWidgetHandler::OnRButtonUp(CXFA_FFWidget* hWidget, m_pDocView->RunInvalidate(); return bRet; } + FX_BOOL CXFA_FFWidgetHandler::OnRButtonDblClk(CXFA_FFWidget* hWidget, uint32_t dwFlags, FX_FLOAT fx, @@ -162,6 +134,7 @@ FX_BOOL CXFA_FFWidgetHandler::OnRButtonDblClk(CXFA_FFWidget* hWidget, m_pDocView->RunInvalidate(); return bRet; } + FX_BOOL CXFA_FFWidgetHandler::OnKeyDown(CXFA_FFWidget* hWidget, uint32_t dwKeyCode, uint32_t dwFlags) { @@ -170,6 +143,7 @@ FX_BOOL CXFA_FFWidgetHandler::OnKeyDown(CXFA_FFWidget* hWidget, m_pDocView->UpdateDocView(); return bRet; } + FX_BOOL CXFA_FFWidgetHandler::OnKeyUp(CXFA_FFWidget* hWidget, uint32_t dwKeyCode, uint32_t dwFlags) { @@ -177,6 +151,7 @@ FX_BOOL CXFA_FFWidgetHandler::OnKeyUp(CXFA_FFWidget* hWidget, m_pDocView->RunInvalidate(); return bRet; } + FX_BOOL CXFA_FFWidgetHandler::OnChar(CXFA_FFWidget* hWidget, uint32_t dwChar, uint32_t dwFlags) { @@ -184,6 +159,7 @@ FX_BOOL CXFA_FFWidgetHandler::OnChar(CXFA_FFWidget* hWidget, m_pDocView->RunInvalidate(); return bRet; } + uint32_t CXFA_FFWidgetHandler::OnHitTest(CXFA_FFWidget* hWidget, FX_FLOAT fx, FX_FLOAT fy) { @@ -193,12 +169,14 @@ uint32_t CXFA_FFWidgetHandler::OnHitTest(CXFA_FFWidget* hWidget, hWidget->Rotate2Normal(fx, fy); return hWidget->OnHitTest(fx, fy); } + FX_BOOL CXFA_FFWidgetHandler::OnSetCursor(CXFA_FFWidget* hWidget, FX_FLOAT fx, FX_FLOAT fy) { hWidget->Rotate2Normal(fx, fy); return hWidget->OnSetCursor(fx, fy); } + void CXFA_FFWidgetHandler::RenderWidget(CXFA_FFWidget* hWidget, CFX_Graphics* pGS, CFX_Matrix* pMatrix, @@ -206,33 +184,29 @@ void CXFA_FFWidgetHandler::RenderWidget(CXFA_FFWidget* hWidget, hWidget->RenderWidget(pGS, pMatrix, bHighlight ? XFA_WIDGETSTATUS_Highlight : 0, 0); } + FX_BOOL CXFA_FFWidgetHandler::HasEvent(CXFA_WidgetAcc* pWidgetAcc, XFA_EVENTTYPE eEventType) { - if (!pWidgetAcc || eEventType == XFA_EVENT_Unknown) { + if (!pWidgetAcc || eEventType == XFA_EVENT_Unknown) return FALSE; - } - if (pWidgetAcc->GetClassID() == XFA_ELEMENT_Draw) { + if (pWidgetAcc->GetClassID() == XFA_ELEMENT_Draw) return FALSE; - } + switch (eEventType) { case XFA_EVENT_Calculate: { CXFA_Calculate calc = pWidgetAcc->GetCalculate(); - if (!calc) { + if (!calc) return FALSE; - } - if (calc.GetScript()) { + if (calc.GetScript()) return TRUE; - } return FALSE; } case XFA_EVENT_Validate: { CXFA_Validate val = pWidgetAcc->GetValidate(); - if (!val) { + if (!val) return FALSE; - } - if (val.GetScript()) { + if (val.GetScript()) return TRUE; - } return FALSE; } default: @@ -242,14 +216,14 @@ FX_BOOL CXFA_FFWidgetHandler::HasEvent(CXFA_WidgetAcc* pWidgetAcc, return pWidgetAcc->GetEventByActivity(gs_EventActivity[eEventType], eventArray); } + int32_t CXFA_FFWidgetHandler::ProcessEvent(CXFA_WidgetAcc* pWidgetAcc, CXFA_EventParam* pParam) { - if (!pParam || pParam->m_eType == XFA_EVENT_Unknown) { + if (!pParam || pParam->m_eType == XFA_EVENT_Unknown) return XFA_EVENTERROR_NotExist; - } - if (!pWidgetAcc || pWidgetAcc->GetClassID() == XFA_ELEMENT_Draw) { + if (!pWidgetAcc || pWidgetAcc->GetClassID() == XFA_ELEMENT_Draw) return XFA_EVENTERROR_NotExist; - } + switch (pParam->m_eType) { case XFA_EVENT_Calculate: return pWidgetAcc->ProcessCalculate(); @@ -262,12 +236,11 @@ int32_t CXFA_FFWidgetHandler::ProcessEvent(CXFA_WidgetAcc* pWidgetAcc, return XFA_EVENTERROR_Disabled; case XFA_EVENT_InitCalculate: { CXFA_Calculate calc = pWidgetAcc->GetCalculate(); - if (!calc) { + if (!calc) return XFA_EVENTERROR_NotExist; - } - if (pWidgetAcc->GetNode()->HasFlag(XFA_NODEFLAG_UserInteractive)) { + if (pWidgetAcc->GetNode()->HasFlag(XFA_NODEFLAG_UserInteractive)) return XFA_EVENTERROR_Disabled; - } + CXFA_Script script = calc.GetScript(); return pWidgetAcc->ExecuteScript(script, pParam); } @@ -278,6 +251,7 @@ int32_t CXFA_FFWidgetHandler::ProcessEvent(CXFA_WidgetAcc* pWidgetAcc, pWidgetAcc->ProcessEvent(gs_EventActivity[pParam->m_eType], pParam); return iRet; } + CXFA_FFWidget* CXFA_FFWidgetHandler::CreateWidget(CXFA_FFWidget* hParent, XFA_WIDGETTYPE eType, CXFA_FFWidget* hBefore) { @@ -287,9 +261,9 @@ CXFA_FFWidget* CXFA_FFWidgetHandler::CreateWidget(CXFA_FFWidget* hParent, hBefore ? hBefore->GetDataAcc()->GetNode() : nullptr; CXFA_Node* pNewFormItem = CreateWidgetFormItem(eType, pParentFormItem, pBeforeFormItem); - if (pNewFormItem == NULL) { - return NULL; - } + if (!pNewFormItem) + return nullptr; + pNewFormItem->GetTemplateNode()->SetFlag(XFA_NODEFLAG_Initialized); pNewFormItem->SetFlag(XFA_NODEFLAG_Initialized); m_pDocView->RunLayout(); @@ -297,13 +271,14 @@ CXFA_FFWidget* CXFA_FFWidgetHandler::CreateWidget(CXFA_FFWidget* hParent, m_pDocView->GetXFALayout()->GetLayoutItem(pNewFormItem); return (CXFA_FFWidget*)pLayout; } + CXFA_Node* CXFA_FFWidgetHandler::CreateWidgetFormItem( XFA_WIDGETTYPE eType, CXFA_Node* pParent, CXFA_Node* pBefore) const { switch (eType) { case XFA_WIDGETTYPE_Barcode: - return NULL; + return nullptr; case XFA_WIDGETTYPE_PushButton: return CreatePushButton(pParent, pBefore); case XFA_WIDGETTYPE_CheckButton: @@ -343,10 +318,10 @@ CXFA_Node* CXFA_FFWidgetHandler::CreateWidgetFormItem( case XFA_WIDGETTYPE_Subform: return CreateSubform(pParent, pBefore); default: - break; + return nullptr; } - return NULL; } + CXFA_Node* CXFA_FFWidgetHandler::CreatePushButton(CXFA_Node* pParent, CXFA_Node* pBefore) const { CXFA_Node* pField = CreateField(XFA_ELEMENT_Button, pParent, pBefore); @@ -354,30 +329,38 @@ CXFA_Node* CXFA_FFWidgetHandler::CreatePushButton(CXFA_Node* pParent, CXFA_Node* pValue = CreateCopyNode(XFA_ELEMENT_Value, pCaption); CXFA_Node* pText = CreateCopyNode(XFA_ELEMENT_Text, pValue); pText->SetContent(FX_WSTRC(L"Button"), FX_WSTRC(L"Button"), FALSE); + CXFA_Node* pPara = CreateCopyNode(XFA_ELEMENT_Para, pCaption); pPara->SetEnum(XFA_ATTRIBUTE_VAlign, XFA_ATTRIBUTEENUM_Middle, FALSE); pPara->SetEnum(XFA_ATTRIBUTE_HAlign, XFA_ATTRIBUTEENUM_Center, FALSE); CreateFontNode(pCaption); + CXFA_Node* pBorder = CreateCopyNode(XFA_ELEMENT_Border, pField); pBorder->SetEnum(XFA_ATTRIBUTE_Hand, XFA_ATTRIBUTEENUM_Right, FALSE); + CXFA_Node* pEdge = CreateCopyNode(XFA_ELEMENT_Edge, pBorder); pEdge->SetEnum(XFA_ATTRIBUTE_Stroke, XFA_ATTRIBUTEENUM_Raised, FALSE); + CXFA_Node* pFill = CreateCopyNode(XFA_ELEMENT_Fill, pBorder); CXFA_Node* pColor = CreateCopyNode(XFA_ELEMENT_Color, pFill); pColor->SetCData(XFA_ATTRIBUTE_Value, FX_WSTRC(L"212, 208, 200"), FALSE); + CXFA_Node* pBind = CreateCopyNode(XFA_ELEMENT_Bind, pField); pBind->SetEnum(XFA_ATTRIBUTE_Match, XFA_ATTRIBUTEENUM_None); + return pField; } + CXFA_Node* CXFA_FFWidgetHandler::CreateCheckButton(CXFA_Node* pParent, CXFA_Node* pBefore) const { - CXFA_Node* pField = CreateField(XFA_ELEMENT_CheckButton, pParent, pBefore); - return pField; + return CreateField(XFA_ELEMENT_CheckButton, pParent, pBefore); } + CXFA_Node* CXFA_FFWidgetHandler::CreateExclGroup(CXFA_Node* pParent, CXFA_Node* pBefore) const { return CreateFormItem(XFA_ELEMENT_ExclGroup, pParent, pBefore); } + CXFA_Node* CXFA_FFWidgetHandler::CreateRadioButton(CXFA_Node* pParent, CXFA_Node* pBefore) const { CXFA_Node* pField = CreateField(XFA_ELEMENT_CheckButton, pParent, pBefore); @@ -386,38 +369,41 @@ CXFA_Node* CXFA_FFWidgetHandler::CreateRadioButton(CXFA_Node* pParent, pWidget->SetEnum(XFA_ATTRIBUTE_Shape, XFA_ATTRIBUTEENUM_Round); return pField; } + CXFA_Node* CXFA_FFWidgetHandler::CreateDatetimeEdit(CXFA_Node* pParent, CXFA_Node* pBefore) const { CXFA_Node* pField = CreateField(XFA_ELEMENT_DateTimeEdit, pParent, pBefore); CreateValueNode(XFA_ELEMENT_Date, pField); return pField; } + CXFA_Node* CXFA_FFWidgetHandler::CreateDecimalField(CXFA_Node* pParent, CXFA_Node* pBefore) const { CXFA_Node* pField = CreateNumericField(pParent, pBefore); CreateValueNode(XFA_ELEMENT_Decimal, pField); return pField; } + CXFA_Node* CXFA_FFWidgetHandler::CreateNumericField(CXFA_Node* pParent, CXFA_Node* pBefore) const { - CXFA_Node* pField = CreateField(XFA_ELEMENT_NumericEdit, pParent, pBefore); - return pField; + return CreateField(XFA_ELEMENT_NumericEdit, pParent, pBefore); } + CXFA_Node* CXFA_FFWidgetHandler::CreateSignature(CXFA_Node* pParent, CXFA_Node* pBefore) const { - CXFA_Node* pField = CreateField(XFA_ELEMENT_Signature, pParent, pBefore); - return pField; + return CreateField(XFA_ELEMENT_Signature, pParent, pBefore); } + CXFA_Node* CXFA_FFWidgetHandler::CreateTextEdit(CXFA_Node* pParent, CXFA_Node* pBefore) const { - CXFA_Node* pField = CreateField(XFA_ELEMENT_TextEdit, pParent, pBefore); - return pField; + return CreateField(XFA_ELEMENT_TextEdit, pParent, pBefore); } + CXFA_Node* CXFA_FFWidgetHandler::CreateDropdownList(CXFA_Node* pParent, CXFA_Node* pBefore) const { - CXFA_Node* pField = CreateField(XFA_ELEMENT_ChoiceList, pParent, pBefore); - return pField; + return CreateField(XFA_ELEMENT_ChoiceList, pParent, pBefore); } + CXFA_Node* CXFA_FFWidgetHandler::CreateListBox(CXFA_Node* pParent, CXFA_Node* pBefore) const { CXFA_Node* pField = CreateDropdownList(pParent, pBefore); @@ -427,11 +413,12 @@ CXFA_Node* CXFA_FFWidgetHandler::CreateListBox(CXFA_Node* pParent, pListBox->SetEnum(XFA_ATTRIBUTE_CommitOn, XFA_ATTRIBUTEENUM_Exit); return pField; } + CXFA_Node* CXFA_FFWidgetHandler::CreateImageField(CXFA_Node* pParent, CXFA_Node* pBefore) const { - CXFA_Node* pField = CreateField(XFA_ELEMENT_ImageEdit, pParent, pBefore); - return pField; + return CreateField(XFA_ELEMENT_ImageEdit, pParent, pBefore); } + CXFA_Node* CXFA_FFWidgetHandler::CreatePasswordEdit(CXFA_Node* pParent, CXFA_Node* pBefore) const { CXFA_Node* pField = CreateField(XFA_ELEMENT_PasswordEdit, pParent, pBefore); @@ -439,6 +426,7 @@ CXFA_Node* CXFA_FFWidgetHandler::CreatePasswordEdit(CXFA_Node* pParent, pBind->SetEnum(XFA_ATTRIBUTE_Match, XFA_ATTRIBUTEENUM_None, FALSE); return pField; } + CXFA_Node* CXFA_FFWidgetHandler::CreateField(XFA_ELEMENT eElement, CXFA_Node* pParent, CXFA_Node* pBefore) const { @@ -447,25 +435,29 @@ CXFA_Node* CXFA_FFWidgetHandler::CreateField(XFA_ELEMENT eElement, CreateFontNode(pField); return pField; } + CXFA_Node* CXFA_FFWidgetHandler::CreateArc(CXFA_Node* pParent, CXFA_Node* pBefore) const { return CreateDraw(XFA_ELEMENT_Arc, pParent, pBefore); } + CXFA_Node* CXFA_FFWidgetHandler::CreateRectangle(CXFA_Node* pParent, CXFA_Node* pBefore) const { return CreateDraw(XFA_ELEMENT_Rectangle, pParent, pBefore); } + CXFA_Node* CXFA_FFWidgetHandler::CreateImage(CXFA_Node* pParent, CXFA_Node* pBefore) const { CXFA_Node* pField = CreateDraw(XFA_ELEMENT_Image, pParent, pBefore); CreateCopyNode(XFA_ELEMENT_ImageEdit, CreateCopyNode(XFA_ELEMENT_Ui, pField)); return pField; } + CXFA_Node* CXFA_FFWidgetHandler::CreateLine(CXFA_Node* pParent, CXFA_Node* pBefore) const { - CXFA_Node* pField = CreateDraw(XFA_ELEMENT_Line, pParent, pBefore); - return pField; + return CreateDraw(XFA_ELEMENT_Line, pParent, pBefore); } + CXFA_Node* CXFA_FFWidgetHandler::CreateText(CXFA_Node* pParent, CXFA_Node* pBefore) const { CXFA_Node* pField = CreateDraw(XFA_ELEMENT_Text, pParent, pBefore); @@ -473,6 +465,7 @@ CXFA_Node* CXFA_FFWidgetHandler::CreateText(CXFA_Node* pParent, CreateFontNode(pField); return pField; } + CXFA_Node* CXFA_FFWidgetHandler::CreateDraw(XFA_ELEMENT eElement, CXFA_Node* pParent, CXFA_Node* pBefore) const { @@ -480,11 +473,12 @@ CXFA_Node* CXFA_FFWidgetHandler::CreateDraw(XFA_ELEMENT eElement, CreateValueNode(eElement, pDraw); return pDraw; } + CXFA_Node* CXFA_FFWidgetHandler::CreateSubform(CXFA_Node* pParent, CXFA_Node* pBefore) const { - CXFA_Node* pSubform = CreateFormItem(XFA_ELEMENT_Subform, pParent, pBefore); - return pSubform; + return CreateFormItem(XFA_ELEMENT_Subform, pParent, pBefore); } + CXFA_Node* CXFA_FFWidgetHandler::CreateFormItem(XFA_ELEMENT eElement, CXFA_Node* pParent, CXFA_Node* pBefore) const { @@ -494,6 +488,7 @@ CXFA_Node* CXFA_FFWidgetHandler::CreateFormItem(XFA_ELEMENT eElement, pParent->InsertChild(pNewFormItem, pBefore); return pNewFormItem; } + CXFA_Node* CXFA_FFWidgetHandler::CreateCopyNode(XFA_ELEMENT eElement, CXFA_Node* pParent, CXFA_Node* pBefore) const { @@ -506,6 +501,7 @@ CXFA_Node* CXFA_FFWidgetHandler::CreateCopyNode(XFA_ELEMENT eElement, pParent->InsertChild(pNewNode, pBefore); return pNewNode; } + CXFA_Node* CXFA_FFWidgetHandler::CreateTemplateNode(XFA_ELEMENT eElement, CXFA_Node* pParent, CXFA_Node* pBefore) const { @@ -516,110 +512,44 @@ CXFA_Node* CXFA_FFWidgetHandler::CreateTemplateNode(XFA_ELEMENT eElement, pParent->InsertChild(pNewTemplateNode, pBefore); return pNewTemplateNode; } + CXFA_Node* CXFA_FFWidgetHandler::CreateFontNode(CXFA_Node* pParent) const { CXFA_Node* pFont = CreateCopyNode(XFA_ELEMENT_Font, pParent); pFont->SetCData(XFA_ATTRIBUTE_Typeface, FX_WSTRC(L"Myriad Pro"), FALSE); return pFont; } + CXFA_Node* CXFA_FFWidgetHandler::CreateMarginNode(CXFA_Node* pParent, uint32_t dwFlags, FX_FLOAT fInsets[4]) const { CXFA_Node* pMargin = CreateCopyNode(XFA_ELEMENT_Margin, pParent); - if (dwFlags & 0x01) { + if (dwFlags & 0x01) pMargin->SetMeasure(XFA_ATTRIBUTE_LeftInset, CXFA_Measurement(fInsets[0], XFA_UNIT_Pt), FALSE); - } - if (dwFlags & 0x02) { + if (dwFlags & 0x02) pMargin->SetMeasure(XFA_ATTRIBUTE_TopInset, CXFA_Measurement(fInsets[1], XFA_UNIT_Pt), FALSE); - } - if (dwFlags & 0x04) { + if (dwFlags & 0x04) pMargin->SetMeasure(XFA_ATTRIBUTE_RightInset, CXFA_Measurement(fInsets[2], XFA_UNIT_Pt), FALSE); - } - if (dwFlags & 0x08) { + if (dwFlags & 0x08) pMargin->SetMeasure(XFA_ATTRIBUTE_BottomInset, CXFA_Measurement(fInsets[3], XFA_UNIT_Pt), FALSE); - } return pMargin; } + CXFA_Node* CXFA_FFWidgetHandler::CreateValueNode(XFA_ELEMENT eValue, CXFA_Node* pParent) const { CXFA_Node* pValue = CreateCopyNode(XFA_ELEMENT_Value, pParent); CreateCopyNode(eValue, pValue); return pValue; } + CXFA_Document* CXFA_FFWidgetHandler::GetObjFactory() const { return GetXFADoc()->GetParser()->GetFactory(); } + CXFA_Document* CXFA_FFWidgetHandler::GetXFADoc() const { return ((CXFA_FFDoc*)(m_pDocView->GetDoc()))->GetXFADoc(); } -CXFA_FFMenuHandler::CXFA_FFMenuHandler() {} - -CXFA_FFMenuHandler::~CXFA_FFMenuHandler() {} - -FX_BOOL CXFA_FFMenuHandler::CanCopy(CXFA_FFWidget* hWidget) { - return hWidget->CanCopy(); -} -FX_BOOL CXFA_FFMenuHandler::CanCut(CXFA_FFWidget* hWidget) { - return hWidget->CanCut(); -} -FX_BOOL CXFA_FFMenuHandler::CanPaste(CXFA_FFWidget* hWidget) { - return hWidget->CanPaste(); -} -FX_BOOL CXFA_FFMenuHandler::CanSelectAll(CXFA_FFWidget* hWidget) { - return hWidget->CanSelectAll(); -} -FX_BOOL CXFA_FFMenuHandler::CanDelete(CXFA_FFWidget* hWidget) { - return hWidget->CanDelete(); -} -FX_BOOL CXFA_FFMenuHandler::CanDeSelect(CXFA_FFWidget* hWidget) { - return hWidget->CanDeSelect(); -} -FX_BOOL CXFA_FFMenuHandler::Copy(CXFA_FFWidget* hWidget, - CFX_WideString& wsText) { - return hWidget->Copy(wsText); -} -FX_BOOL CXFA_FFMenuHandler::Cut(CXFA_FFWidget* hWidget, - CFX_WideString& wsText) { - return hWidget->Cut(wsText); -} -FX_BOOL CXFA_FFMenuHandler::Paste(CXFA_FFWidget* hWidget, - const CFX_WideString& wsText) { - return hWidget->Paste(wsText); -} -FX_BOOL CXFA_FFMenuHandler::SelectAll(CXFA_FFWidget* hWidget) { - return hWidget->SelectAll(); -} -FX_BOOL CXFA_FFMenuHandler::Delete(CXFA_FFWidget* hWidget) { - return hWidget->Delete(); -} -FX_BOOL CXFA_FFMenuHandler::DeSelect(CXFA_FFWidget* hWidget) { - return hWidget->DeSelect(); -} -FX_BOOL CXFA_FFMenuHandler::CanUndo(CXFA_FFWidget* hWidget) { - return hWidget->CanUndo(); -} -FX_BOOL CXFA_FFMenuHandler::CanRedo(CXFA_FFWidget* hWidget) { - return hWidget->CanRedo(); -} -FX_BOOL CXFA_FFMenuHandler::Undo(CXFA_FFWidget* hWidget) { - return hWidget->Undo(); -} -FX_BOOL CXFA_FFMenuHandler::Redo(CXFA_FFWidget* hWidget) { - return hWidget->Redo(); -} -FX_BOOL CXFA_FFMenuHandler::GetSuggestWords( - CXFA_FFWidget* hWidget, - CFX_PointF pointf, - std::vector<CFX_ByteString>& sSuggest) { - return hWidget->GetSuggestWords(pointf, sSuggest); -} -FX_BOOL CXFA_FFMenuHandler::ReplaceSpellCheckWord( - CXFA_FFWidget* hWidget, - CFX_PointF pointf, - const CFX_ByteStringC& bsReplace) { - return hWidget->ReplaceSpellCheckWord(pointf, bsReplace); -} diff --git a/xfa/fxfa/app/xfa_fwltheme.cpp b/xfa/fxfa/app/xfa_fwltheme.cpp index 4c3d4de801..f36c1bcc97 100644 --- a/xfa/fxfa/app/xfa_fwltheme.cpp +++ b/xfa/fxfa/app/xfa_fwltheme.cpp @@ -21,9 +21,9 @@ #include "xfa/fwl/basewidget/ifwl_scrollbar.h" #include "xfa/fwl/core/cfwl_themebackground.h" #include "xfa/fwl/core/cfwl_themetext.h" -#include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxgraphics/cfx_color.h" #include "xfa/include/fxfa/xfa_ffapp.h" +#include "xfa/include/fxfa/xfa_ffwidget.h" namespace { diff --git a/xfa/fxfa/app/xfa_rendercontext.cpp b/xfa/fxfa/app/xfa_rendercontext.cpp index a454ec0e5d..59ed31a21d 100644 --- a/xfa/fxfa/app/xfa_rendercontext.cpp +++ b/xfa/fxfa/app/xfa_rendercontext.cpp @@ -6,9 +6,9 @@ #include "xfa/include/fxfa/xfa_rendercontext.h" -#include "xfa/fxfa/app/xfa_ffwidget.h" #include "xfa/fxgraphics/include/cfx_graphics.h" #include "xfa/include/fxfa/xfa_ffpageview.h" +#include "xfa/include/fxfa/xfa_ffwidget.h" #define XFA_RENDERCONTEXT_MaxCount 30 |