summaryrefslogtreecommitdiff
path: root/xfa/fxfa/app/xfa_ffwidgethandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa/app/xfa_ffwidgethandler.cpp')
-rw-r--r--xfa/fxfa/app/xfa_ffwidgethandler.cpp240
1 files changed, 85 insertions, 155 deletions
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);
-}