CXFA_Node* CXFA_FFWidgetHandler::CreateListBox(CXFA_Node* pParent, CXFA_Node* pBefore) const { CXFA_Node* pField = CreateDropdownList(pParent, pBefore); CXFA_Node* pUi = pField->GetNodeItem(XFA_NODEITEM_FirstChild); CXFA_Node* pListBox = pUi->GetNodeItem(XFA_NODEITEM_FirstChild); pListBox->SetEnum(XFA_ATTRIBUTE_Open, XFA_ATTRIBUTEENUM_Always); pListBox->SetEnum(XFA_ATTRIBUTE_CommitOn, XFA_ATTRIBUTEENUM_Exit); return pField; }
CXFA_Node* CXFA_FFWidgetHandler::CreatePasswordEdit(CXFA_Node* pParent, CXFA_Node* pBefore) const { CXFA_Node* pField = CreateField(XFA_ELEMENT_PasswordEdit, pParent, pBefore); CXFA_Node* pBind = CreateCopyNode(XFA_ELEMENT_Bind, pField); pBind->SetEnum(XFA_ATTRIBUTE_Match, XFA_ATTRIBUTEENUM_None, FALSE); return pField; }
CXFA_Node* XFA_DataDescription_MaybeCreateDataNode( CXFA_Document* pDocument, CXFA_Node* pDataParent, XFA_Element eNodeType, const CFX_WideString& wsName) { if (!pDataParent) { return nullptr; } CXFA_Node* pParentDDNode = pDataParent->GetDataDescriptionNode(); if (!pParentDDNode) { CXFA_Node* pDataNode = pDocument->CreateNode(XFA_XDPPACKET_Datasets, eNodeType); ASSERT(pDataNode); pDataNode->SetCData(XFA_ATTRIBUTE_Name, wsName); pDataNode->CreateXMLMappingNode(); pDataParent->InsertChild(pDataNode); pDataNode->SetFlag(XFA_NodeFlag_Initialized, false); return pDataNode; } else { CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_DDGroup> sIterator(pParentDDNode); for (CXFA_Node* pDDGroupNode = sIterator.GetCurrent(); pDDGroupNode; pDDGroupNode = sIterator.MoveToNext()) { if (pDDGroupNode != pParentDDNode) { if (pDDGroupNode->GetElementType() != XFA_Element::DataGroup) { continue; } CFX_WideString wsNamespace; if (!pDDGroupNode->TryNamespace(wsNamespace) || wsNamespace != FX_WSTRC(L"http://ns.adobe.com/data-description/")) { continue; } } CXFA_Node* pDDNode = pDDGroupNode->GetFirstChildByName(wsName.AsStringC()); if (!pDDNode) { continue; } if (pDDNode->GetElementType() != eNodeType) { break; } CXFA_Node* pDataNode = pDocument->CreateNode(XFA_XDPPACKET_Datasets, eNodeType); ASSERT(pDataNode); pDataNode->SetCData(XFA_ATTRIBUTE_Name, wsName); pDataNode->CreateXMLMappingNode(); if (eNodeType == XFA_Element::DataValue && pDDNode->GetEnum(XFA_ATTRIBUTE_Contains) == XFA_ATTRIBUTEENUM_MetaData) { pDataNode->SetEnum(XFA_ATTRIBUTE_Contains, XFA_ATTRIBUTEENUM_MetaData); } pDataParent->InsertChild(pDataNode); pDataNode->SetDataDescriptionNode(pDDNode); pDataNode->SetFlag(XFA_NodeFlag_Initialized, false); return pDataNode; } return nullptr; } }
CXFA_Node* CXFA_FFWidgetHandler::CreateRadioButton(CXFA_Node* pParent, CXFA_Node* pBefore) const { CXFA_Node* pField = CreateField(XFA_ELEMENT_CheckButton, pParent, pBefore); CXFA_Node* pUi = pField->GetFirstChildByClass(XFA_ELEMENT_Ui); CXFA_Node* pWidget = pUi->GetFirstChildByClass(XFA_ELEMENT_CheckButton); pWidget->SetEnum(XFA_ATTRIBUTE_Shape, XFA_ATTRIBUTEENUM_Round); return pField; }
CXFA_Node* CXFA_FFWidgetHandler::CreatePushButton(CXFA_Node* pParent, CXFA_Node* pBefore) const { CXFA_Node* pField = CreateField(XFA_ELEMENT_Button, pParent, pBefore); CXFA_Node* pCaption = CreateCopyNode(XFA_ELEMENT_Caption, pField); 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; }