summaryrefslogtreecommitdiff
path: root/xfa/fxfa/app/xfa_ffwidgetacc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa/app/xfa_ffwidgetacc.cpp')
-rw-r--r--xfa/fxfa/app/xfa_ffwidgetacc.cpp128
1 files changed, 60 insertions, 68 deletions
diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp
index 7f53027e5c..218537618f 100644
--- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp
+++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp
@@ -35,33 +35,24 @@
CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) {
bRichText = false;
- if (m_pTextNode) {
- if (m_pTextNode->GetElementType() == XFA_Element::ExData) {
- CFX_WideString wsContentType;
- m_pTextNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType,
- false);
- if (wsContentType == L"text/html") {
- bRichText = true;
- }
- }
- return m_pTextNode;
- }
+
if (m_eType == XFA_TEXTPROVIDERTYPE_Text) {
CXFA_Node* pElementNode = m_pWidgetAcc->GetNode();
CXFA_Node* pValueNode = pElementNode->GetChild(0, XFA_Element::Value);
- if (!pValueNode) {
+ if (!pValueNode)
return nullptr;
- }
+
CXFA_Node* pChildNode = pValueNode->GetNodeItem(XFA_NODEITEM_FirstChild);
if (pChildNode && pChildNode->GetElementType() == XFA_Element::ExData) {
CFX_WideString wsContentType;
pChildNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, false);
- if (wsContentType == L"text/html") {
+ if (wsContentType == L"text/html")
bRichText = true;
- }
}
return pChildNode;
- } else if (m_eType == XFA_TEXTPROVIDERTYPE_Datasets) {
+ }
+
+ if (m_eType == XFA_TEXTPROVIDERTYPE_Datasets) {
CXFA_Node* pBind = m_pWidgetAcc->GetDatasets();
CFX_XMLNode* pXMLNode = pBind->GetXMLMappingNode();
ASSERT(pXMLNode);
@@ -71,105 +62,106 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) {
pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) {
if (pXMLChild->GetType() == FX_XMLNODE_Element) {
CFX_XMLElement* pElement = static_cast<CFX_XMLElement*>(pXMLChild);
- if (XFA_RecognizeRichText(pElement)) {
+ if (XFA_RecognizeRichText(pElement))
bRichText = true;
- }
}
}
return pBind;
- } else if (m_eType == XFA_TEXTPROVIDERTYPE_Caption) {
+ }
+
+ if (m_eType == XFA_TEXTPROVIDERTYPE_Caption) {
CXFA_Node* pCaptionNode =
m_pWidgetAcc->GetNode()->GetChild(0, XFA_Element::Caption);
- if (!pCaptionNode) {
+ if (!pCaptionNode)
return nullptr;
- }
+
CXFA_Node* pValueNode = pCaptionNode->GetChild(0, XFA_Element::Value);
- if (!pValueNode) {
+ if (!pValueNode)
return nullptr;
- }
+
CXFA_Node* pChildNode = pValueNode->GetNodeItem(XFA_NODEITEM_FirstChild);
if (pChildNode && pChildNode->GetElementType() == XFA_Element::ExData) {
CFX_WideString wsContentType;
pChildNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, false);
- if (wsContentType == L"text/html") {
+ if (wsContentType == L"text/html")
bRichText = true;
- }
}
return pChildNode;
}
+
CXFA_Node* pItemNode =
m_pWidgetAcc->GetNode()->GetChild(0, XFA_Element::Items);
- if (!pItemNode) {
+ if (!pItemNode)
return nullptr;
- }
+
CXFA_Node* pNode = pItemNode->GetNodeItem(XFA_NODEITEM_FirstChild);
while (pNode) {
CFX_WideStringC wsName;
pNode->TryCData(XFA_ATTRIBUTE_Name, wsName);
- if (m_eType == XFA_TEXTPROVIDERTYPE_Rollover && wsName == L"rollover") {
+ if (m_eType == XFA_TEXTPROVIDERTYPE_Rollover && wsName == L"rollover")
return pNode;
- }
- if (m_eType == XFA_TEXTPROVIDERTYPE_Down && wsName == L"down") {
+ if (m_eType == XFA_TEXTPROVIDERTYPE_Down && wsName == L"down")
return pNode;
- }
+
pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling);
}
return nullptr;
}
+
CXFA_Para CXFA_TextProvider::GetParaNode() {
- if (m_eType == XFA_TEXTPROVIDERTYPE_Text) {
+ if (m_eType == XFA_TEXTPROVIDERTYPE_Text)
return m_pWidgetAcc->GetPara();
- }
+
CXFA_Node* pNode = m_pWidgetAcc->GetNode()->GetChild(0, XFA_Element::Caption);
return CXFA_Para(pNode->GetChild(0, XFA_Element::Para));
}
+
CXFA_Font CXFA_TextProvider::GetFontNode() {
- if (m_eType == XFA_TEXTPROVIDERTYPE_Text) {
+ if (m_eType == XFA_TEXTPROVIDERTYPE_Text)
return m_pWidgetAcc->GetFont();
- }
+
CXFA_Node* pNode = m_pWidgetAcc->GetNode()->GetChild(0, XFA_Element::Caption);
pNode = pNode->GetChild(0, XFA_Element::Font);
- if (pNode) {
- return CXFA_Font(pNode);
- }
- return m_pWidgetAcc->GetFont();
+ return pNode ? CXFA_Font(pNode) : m_pWidgetAcc->GetFont();
}
+
bool CXFA_TextProvider::IsCheckButtonAndAutoWidth() {
XFA_Element eType = m_pWidgetAcc->GetUIType();
- if (eType == XFA_Element::CheckButton) {
- float fWidth = 0;
- return !m_pWidgetAcc->GetWidth(fWidth);
- }
- return false;
+ if (eType != XFA_Element::CheckButton)
+ return false;
+
+ float fWidth = 0;
+ return !m_pWidgetAcc->GetWidth(fWidth);
}
+
bool CXFA_TextProvider::GetEmbbedObj(bool bURI,
bool bRaw,
const CFX_WideString& wsAttr,
CFX_WideString& wsValue) {
- if (m_eType != XFA_TEXTPROVIDERTYPE_Text) {
+ if (m_eType != XFA_TEXTPROVIDERTYPE_Text)
return false;
+
+ if (!bURI)
+ return false;
+
+ CXFA_Node* pWidgetNode = m_pWidgetAcc->GetNode();
+ CXFA_Node* pParent = pWidgetNode->GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Document* pDocument = pWidgetNode->GetDocument();
+ CXFA_Node* pIDNode = nullptr;
+ CXFA_WidgetAcc* pEmbAcc = nullptr;
+ if (pParent)
+ pIDNode = pDocument->GetNodeByID(pParent, wsAttr.AsStringC());
+
+ if (!pIDNode) {
+ pIDNode = pDocument->GetNodeByID(
+ ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Form)), wsAttr.AsStringC());
}
- if (bURI) {
- CXFA_Node* pWidgetNode = m_pWidgetAcc->GetNode();
- CXFA_Node* pParent = pWidgetNode->GetNodeItem(XFA_NODEITEM_Parent);
- CXFA_Document* pDocument = pWidgetNode->GetDocument();
- CXFA_Node* pIDNode = nullptr;
- CXFA_WidgetAcc* pEmbAcc = nullptr;
- if (pParent) {
- pIDNode = pDocument->GetNodeByID(pParent, wsAttr.AsStringC());
- }
- if (!pIDNode) {
- pIDNode = pDocument->GetNodeByID(
- ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Form)),
- wsAttr.AsStringC());
- }
- if (pIDNode) {
- pEmbAcc = static_cast<CXFA_WidgetAcc*>(pIDNode->GetWidgetData());
- }
- if (pEmbAcc) {
- pEmbAcc->GetValue(wsValue, XFA_VALUEPICTURE_Display);
- return true;
- }
- }
- return false;
+ if (pIDNode)
+ pEmbAcc = static_cast<CXFA_WidgetAcc*>(pIDNode->GetWidgetData());
+
+ if (!pEmbAcc)
+ return false;
+
+ pEmbAcc->GetValue(wsValue, XFA_VALUEPICTURE_Display);
+ return true;
}