diff options
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r-- | xfa/fxfa/parser/cxfa_boxdata.cpp | 8 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_calculatedata.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_datadata.h | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_fontdata.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_widgetdata.cpp | 12 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 7 |
6 files changed, 18 insertions, 15 deletions
diff --git a/xfa/fxfa/parser/cxfa_boxdata.cpp b/xfa/fxfa/parser/cxfa_boxdata.cpp index 5545494aac..a9f7ace13e 100644 --- a/xfa/fxfa/parser/cxfa_boxdata.cpp +++ b/xfa/fxfa/parser/cxfa_boxdata.cpp @@ -22,7 +22,7 @@ std::vector<CXFA_StrokeData> GetStrokesInternal(CXFA_Node* pNode, bool bNull) { for (i = 0, j = 0; i < 4; i++) { CXFA_CornerData cornerData = CXFA_CornerData( pNode->JSNode()->GetProperty(i, XFA_Element::Corner, i == 0)); - if (cornerData || i == 0) { + if (cornerData.HasValidNode() || i == 0) { strokes[j] = cornerData; } else if (!bNull) { if (i == 1 || i == 2) @@ -33,7 +33,7 @@ std::vector<CXFA_StrokeData> GetStrokesInternal(CXFA_Node* pNode, bool bNull) { j++; CXFA_EdgeData edgeData = CXFA_EdgeData( pNode->JSNode()->GetProperty(i, XFA_Element::Edge, i == 0)); - if (edgeData || i == 0) { + if (edgeData.HasValidNode() || i == 0) { strokes[j] = edgeData; } else if (!bNull) { if (i == 1 || i == 2) @@ -54,10 +54,10 @@ static int32_t Style3D(const std::vector<CXFA_StrokeData>& strokes, strokeData = strokes[0]; for (size_t i = 1; i < strokes.size(); i++) { CXFA_StrokeData find = strokes[i]; - if (!find) + if (!find.HasValidNode()) continue; - if (!strokeData) + if (!strokeData.HasValidNode()) strokeData = find; else if (strokeData.GetStrokeType() != find.GetStrokeType()) strokeData = find; diff --git a/xfa/fxfa/parser/cxfa_calculatedata.cpp b/xfa/fxfa/parser/cxfa_calculatedata.cpp index fb101d9244..ff71e33824 100644 --- a/xfa/fxfa/parser/cxfa_calculatedata.cpp +++ b/xfa/fxfa/parser/cxfa_calculatedata.cpp @@ -28,7 +28,7 @@ WideString CXFA_CalculateData::GetMessageText() { return L""; CXFA_TextData textData(pNode->GetChild(0, XFA_Element::Text, false)); - if (!textData) + if (!textData.HasValidNode()) return L""; return textData.GetContent(); } diff --git a/xfa/fxfa/parser/cxfa_datadata.h b/xfa/fxfa/parser/cxfa_datadata.h index a05b5024fe..260ebbd5da 100644 --- a/xfa/fxfa/parser/cxfa_datadata.h +++ b/xfa/fxfa/parser/cxfa_datadata.h @@ -20,7 +20,7 @@ class CXFA_DataData { explicit CXFA_DataData(CXFA_Node* pNode); virtual ~CXFA_DataData(); - explicit operator bool() const { return !!m_pNode; } + bool HasValidNode() const { return !!m_pNode; } CXFA_Node* GetNode() const { return m_pNode; } XFA_Element GetElementType() const; diff --git a/xfa/fxfa/parser/cxfa_fontdata.cpp b/xfa/fxfa/parser/cxfa_fontdata.cpp index b3e23813ea..17bd6b8f3f 100644 --- a/xfa/fxfa/parser/cxfa_fontdata.cpp +++ b/xfa/fxfa/parser/cxfa_fontdata.cpp @@ -83,5 +83,5 @@ void CXFA_FontData::SetColor(FX_ARGB color) { FX_ARGB CXFA_FontData::GetColor() { CXFA_FillData fillData(m_pNode->GetChild(0, XFA_Element::Fill, false)); - return fillData ? fillData.GetColor(true) : 0xFF000000; + return fillData.HasValidNode() ? fillData.GetColor(true) : 0xFF000000; } diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index cff2d6b004..b5ceb4a4d4 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -364,19 +364,21 @@ CFX_RectF CXFA_WidgetData::GetUIMargin() { pUIChild ? pUIChild->JSNode()->GetProperty(0, XFA_Element::Margin, false) : nullptr); - if (!mgUI) + if (!mgUI.HasValidNode()) return CFX_RectF(); CXFA_BorderData borderData = GetUIBorderData(); - if (borderData && borderData.GetPresence() != XFA_ATTRIBUTEENUM_Visible) + if (borderData.HasValidNode() && + borderData.GetPresence() != XFA_ATTRIBUTEENUM_Visible) { return CFX_RectF(); + } float fLeftInset, fTopInset, fRightInset, fBottomInset; bool bLeft = mgUI.GetLeftInset(fLeftInset); bool bTop = mgUI.GetTopInset(fTopInset); bool bRight = mgUI.GetRightInset(fRightInset); bool bBottom = mgUI.GetBottomInset(fBottomInset); - if (borderData) { + if (borderData.HasValidNode()) { bool bVisible = false; float fThickness = 0; int32_t iType = 0; @@ -492,7 +494,7 @@ XFA_CHECKSTATE CXFA_WidgetData::GetCheckState() { void CXFA_WidgetData::SetCheckState(XFA_CHECKSTATE eCheckState, bool bNotify) { CXFA_WidgetData exclGroup(GetExclGroupNode()); - if (exclGroup) { + if (exclGroup.HasValidNode()) { WideString wsValue; if (eCheckState != XFA_CHECKSTATE_Off) { if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_Element::Items, false)) { @@ -1504,7 +1506,7 @@ WideString CXFA_WidgetData::GetPictureContent(XFA_VALUEPICTURE ePicture) { } case XFA_VALUEPICTURE_DataBind: { CXFA_BindData bindData = GetBindData(); - if (bindData) + if (bindData.HasValidNode()) return bindData.GetPicture(); break; } diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index ac7fb2ec85..9e33b72936 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -141,7 +141,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, CXFA_ImageData imageData = defValueData.GetImageData(); WideString wsContentType; WideString wsHref; - if (imageData) { + if (imageData.HasValidNode()) { imageData.GetContent(wsValue); imageData.GetContentType(wsContentType); imageData.GetHref(wsHref); @@ -297,7 +297,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, FormValueNode_SetChildContent(defValueData.GetNode(), wsNormalizeValue, XFA_Element::Image); CXFA_ImageData imageData = defValueData.GetImageData(); - if (imageData) { + if (imageData.HasValidNode()) { CFX_XMLElement* pXMLDataElement = static_cast<CFX_XMLElement*>(pDataNode->GetXMLMappingNode()); ASSERT(pXMLDataElement); @@ -333,7 +333,8 @@ void CreateDataBinding(CXFA_Node* pFormNode, wsNormalizeValue += wsItem; } CXFA_ExDataData exData = defValueData.GetExData(); - ASSERT(exData); + ASSERT(exData.HasValidNode()); + exData.SetContentType(single ? L"text/plain" : L"text/xml"); } FormValueNode_SetChildContent(defValueData.GetNode(), wsNormalizeValue, |