diff options
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/include/fxfa/fxfa_objectacc.h | 218 | ||||
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_ffcheckbutton.cpp | 6 | ||||
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_ffdocview.cpp | 2 | ||||
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_fffield.cpp | 8 | ||||
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_ffpath.cpp | 2 | ||||
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_ffpushbutton.cpp | 9 | ||||
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_ffwidget.cpp | 18 | ||||
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp | 33 | ||||
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_textlayout.cpp | 24 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_document_datamerger_imp.cpp | 4 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp | 2 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_object_imp.cpp | 22 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_objectacc_imp.cpp | 129 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_utils_imp.cpp | 6 |
14 files changed, 242 insertions, 241 deletions
diff --git a/xfa/include/fxfa/fxfa_objectacc.h b/xfa/include/fxfa/fxfa_objectacc.h index 0c6be3d38a..f549a63e30 100644 --- a/xfa/include/fxfa/fxfa_objectacc.h +++ b/xfa/include/fxfa/fxfa_objectacc.h @@ -52,6 +52,7 @@ class CXFA_Encodings; class CXFA_EncryptionMethods; class CXFA_Reasons; class CXFA_Manifest; + inline FX_BOOL XFA_IsSpace(FX_WCHAR c) { return (c == 0x20) || (c == 0x0d) || (c == 0x0a) || (c == 0x09); } @@ -60,14 +61,13 @@ inline FX_BOOL XFA_IsDigit(FX_WCHAR c) { } typedef CFX_ArrayTemplate<CXFA_Node*> CXFA_NodeArray; typedef CFX_ArrayTemplate<CXFA_Object*> CXFA_ObjArray; + class CXFA_Data { public: - CXFA_Data(CXFA_Node* pNode) : m_pNode(pNode) {} - operator CXFA_Node*() const { return m_pNode; } - CXFA_Node* GetNode() { return m_pNode; } - - FX_BOOL IsExistInXML() const { return m_pNode != NULL; } + explicit CXFA_Data(CXFA_Node* pNode) : m_pNode(pNode) {} + operator bool() const { return !!m_pNode; } + CXFA_Node* GetNode() const { return m_pNode; } XFA_ELEMENT GetClassID() const; protected: @@ -75,38 +75,34 @@ class CXFA_Data { FX_FLOAT& fValue, FX_BOOL bUseDefault = FALSE) const; FX_BOOL SetMeasure(XFA_ATTRIBUTE eAttr, FX_FLOAT fValue); + CXFA_Node* m_pNode; }; + class CXFA_Fill : public CXFA_Data { public: - CXFA_Fill(CXFA_Node* pNode); + explicit CXFA_Fill(CXFA_Node* pNode); ~CXFA_Fill(); int32_t GetPresence(); - FX_ARGB GetColor(FX_BOOL bText = FALSE); - - void SetColor(FX_ARGB color); - int32_t GetFillType(); - int32_t GetPattern(FX_ARGB& foreColor); - int32_t GetStipple(FX_ARGB& stippleColor); - int32_t GetLinear(FX_ARGB& endColor); - int32_t GetRadial(FX_ARGB& endColor); FX_BOOL SetPresence(int32_t iPresence); + void SetColor(FX_ARGB color); FX_BOOL SetFillType(int32_t iType); FX_BOOL SetPattern(int32_t iPattern, FX_ARGB foreColor); FX_BOOL SetStipple(int32_t iStipple, FX_ARGB stippleColor); FX_BOOL SetLinear(int32_t iLinear, FX_ARGB endColor); FX_BOOL SetRadial(int32_t iRadial, FX_ARGB endColor); }; + class CXFA_Margin : public CXFA_Data { public: - CXFA_Margin(CXFA_Node* pNode); + explicit CXFA_Margin(CXFA_Node* pNode); FX_BOOL GetLeftInset(FX_FLOAT& fInset, FX_FLOAT fDefInset = 0) const; FX_BOOL GetTopInset(FX_FLOAT& fInset, FX_FLOAT fDefInset = 0) const; FX_BOOL GetRightInset(FX_FLOAT& fInset, FX_FLOAT fDefInset = 0) const; @@ -116,43 +112,31 @@ class CXFA_Margin : public CXFA_Data { FX_BOOL SetRightInset(FX_FLOAT fInset); FX_BOOL SetBottomInset(FX_FLOAT fInset); }; + class CXFA_Font : public CXFA_Data { public: - CXFA_Font(CXFA_Node* pNode); + explicit CXFA_Font(CXFA_Node* pNode); FX_FLOAT GetBaselineShift(); - FX_FLOAT GetHorizontalScale(); - FX_FLOAT GetVerticalScale(); - FX_FLOAT GetLetterSpacing(); - int32_t GetLineThrough(); - int32_t GetLineThroughPeriod(); - int32_t GetOverline(); - int32_t GetOverlinePeriod(); - int32_t GetUnderline(); - int32_t GetUnderlinePeriod(); - FX_FLOAT GetFontSize(); - void GetTypeface(CFX_WideStringC& wsTypeFace); FX_BOOL IsBold(); - FX_BOOL IsItalic(); - FX_BOOL IsUseKerning(); FX_ARGB GetColor(); - void SetColor(FX_ARGB color); + FX_BOOL SetBaselineShift(FX_FLOAT fBaselineShift); FX_BOOL SetHorizontalScale(FX_FLOAT fHorizontalScale); FX_BOOL SetVerticalScale(FX_FLOAT fVerticalScale); @@ -164,35 +148,29 @@ class CXFA_Font : public CXFA_Data { FX_BOOL SetUnderline(int32_t iUnderline); FX_BOOL SetUnderlinePeriod(int32_t iUnderlinePeriod); }; + class CXFA_Caption : public CXFA_Data { public: - CXFA_Caption(CXFA_Node* pNode); + explicit CXFA_Caption(CXFA_Node* pNode); int32_t GetPresence(); - int32_t GetPlacementType(); - FX_FLOAT GetReserve(); - CXFA_Margin GetMargin(); - CXFA_Font GetFont(); - CXFA_Value GetValue(); - CXFA_Para GetPara(); FX_BOOL SetPresence(int32_t iPresence); FX_BOOL SetPlacementType(int32_t iType); FX_BOOL SetReserve(FX_FLOAT fReserve); }; + class CXFA_Para : public CXFA_Data { public: - CXFA_Para(CXFA_Node* pNode); + explicit CXFA_Para(CXFA_Node* pNode); int32_t GetHorizontalAlign(); - int32_t GetVerticalAlign(); - FX_FLOAT GetLineHeight(); FX_FLOAT GetMarginLeft(); FX_FLOAT GetMarginRight(); @@ -214,6 +192,7 @@ class CXFA_Para : public CXFA_Data { FX_BOOL SetTextIndent(FX_FLOAT fTextIndent); FX_BOOL SetWidows(int32_t iWidows); }; + class CXFA_Keep : public CXFA_Data { public: CXFA_Keep(CXFA_Node* pNode, CXFA_Node* pParent); @@ -228,6 +207,7 @@ class CXFA_Keep : public CXFA_Data { private: CXFA_Node* m_pParent; }; + enum XFA_TEXTENCODING { XFA_TEXTENCODING_None, XFA_TEXTENCODING_Big5, @@ -242,12 +222,12 @@ enum XFA_TEXTENCODING { XFA_TEXTENCODING_UTF16, XFA_TEXTENCODING_UTF8 }; + class CXFA_Event : public CXFA_Data { public: - CXFA_Event(CXFA_Node* pNode); + explicit CXFA_Event(CXFA_Node* pNode); int32_t GetActivity(); - int32_t GetEventType(); void GetRef(CFX_WideStringC& wsRef); @@ -256,7 +236,6 @@ class CXFA_Event : public CXFA_Data { void GetExecuteConnection(CFX_WideString& wsConnection); CXFA_Script GetScript(); - CXFA_Submit GetSubmit(); int32_t GetSignDataOperation(); @@ -269,16 +248,18 @@ class CXFA_Event : public CXFA_Data { FX_BOOL SetSignDataOperation(int32_t iOperation); FX_BOOL SetSignDataTarget(const CFX_WideString& wsTarget); }; + enum XFA_SCRIPTTYPE { XFA_SCRIPTTYPE_Formcalc = 0, XFA_SCRIPTTYPE_Javascript, XFA_SCRIPTTYPE_Unkown, }; + class CXFA_Script : public CXFA_Data { public: - CXFA_Script(CXFA_Node* pNode); - void GetBinding(CFX_WideString& wsBinding); + explicit CXFA_Script(CXFA_Node* pNode); + void GetBinding(CFX_WideString& wsBinding); XFA_SCRIPTTYPE GetContentType(); int32_t GetRunAt(); void GetExpression(CFX_WideString& wsExpression); @@ -287,9 +268,11 @@ class CXFA_Script : public CXFA_Data { FX_BOOL SetRunAt(int32_t iRunAt); FX_BOOL SetExpression(const CFX_WideString& wsExpression); }; + class CXFA_Submit : public CXFA_Data { public: - CXFA_Submit(CXFA_Node* pNode); + explicit CXFA_Submit(CXFA_Node* pNode); + FX_BOOL IsSubmitEmbedPDF(); int32_t GetSubmitFormat(); void GetSubmitTarget(CFX_WideStringC& wsTarget); @@ -300,12 +283,12 @@ class CXFA_Submit : public CXFA_Data { FX_BOOL SetSubmitTextEncoding(XFA_TEXTENCODING eTextEncoding); FX_BOOL SetSubmitXDPContent(const CFX_WideString& wsContent); }; + class CXFA_Value : public CXFA_Data { public: - CXFA_Value(CXFA_Node* pNode) : CXFA_Data(pNode) {} + explicit CXFA_Value(CXFA_Node* pNode) : CXFA_Data(pNode) {} XFA_ELEMENT GetChildValueClassID(); - FX_BOOL GetChildValueContent(CFX_WideString& wsContent); CXFA_Arc GetArc(); CXFA_Line GetLine(); @@ -317,18 +300,22 @@ class CXFA_Value : public CXFA_Data { FX_BOOL bNotify = FALSE, XFA_ELEMENT iType = XFA_ELEMENT_UNKNOWN); }; + class CXFA_Line : public CXFA_Data { public: - CXFA_Line(CXFA_Node* pNode) : CXFA_Data(pNode) {} + explicit CXFA_Line(CXFA_Node* pNode) : CXFA_Data(pNode) {} + int32_t GetHand(); FX_BOOL GetSlop(); CXFA_Edge GetEdge(); FX_BOOL SetHand(int32_t iHand); FX_BOOL SetSlop(int32_t iSlop); }; + class CXFA_Text : public CXFA_Data { public: - CXFA_Text(CXFA_Node* pNode); + explicit CXFA_Text(CXFA_Node* pNode); + void GetName(CFX_WideStringC& wsName); int32_t GetMaxChars(); void GetRid(CFX_WideStringC& wsRid); @@ -338,9 +325,11 @@ class CXFA_Text : public CXFA_Data { FX_BOOL SetMaxChars(int32_t iMaxChars); FX_BOOL SetRid(const CFX_WideString& wsRid); }; + class CXFA_ExData : public CXFA_Data { public: - CXFA_ExData(CXFA_Node* pNode); + explicit CXFA_ExData(CXFA_Node* pNode); + void GetContentType(CFX_WideStringC& wsContentType); void GetHref(CFX_WideStringC& wsHref); int32_t GetMaxLength(); @@ -357,9 +346,11 @@ class CXFA_ExData : public CXFA_Data { FX_BOOL bScriptModify = FALSE, FX_BOOL bSyncData = TRUE); }; + class CXFA_Image : public CXFA_Data { public: CXFA_Image(CXFA_Node* pNode, FX_BOOL bDefValue); + int32_t GetAspect(); FX_BOOL GetContentType(CFX_WideString& wsContentType); FX_BOOL GetHref(CFX_WideString& wsHref); @@ -374,9 +365,10 @@ class CXFA_Image : public CXFA_Data { protected: FX_BOOL m_bDefValue; }; + class CXFA_Calculate : public CXFA_Data { public: - CXFA_Calculate(CXFA_Node* pNode); + explicit CXFA_Calculate(CXFA_Node* pNode); int32_t GetOverride(); CXFA_Script GetScript(); @@ -384,9 +376,11 @@ class CXFA_Calculate : public CXFA_Data { FX_BOOL SetOverride(int32_t iOverride); FX_BOOL SetMessageText(const CFX_WideString& wsMessage); }; + class CXFA_Validate : public CXFA_Data { public: - CXFA_Validate(CXFA_Node* pNode); + explicit CXFA_Validate(CXFA_Node* pNode); + int32_t GetFormatTest(); FX_BOOL SetFormatTest(CFX_WideString wsValue); int32_t GetNullTest(); @@ -410,16 +404,19 @@ class CXFA_Validate : public CXFA_Data { CFX_WideString& wsValue, XFA_ATTRIBUTEENUM eName); }; + class CXFA_Variables : public CXFA_Data { public: - CXFA_Variables(CXFA_Node* pNode); + explicit CXFA_Variables(CXFA_Node* pNode); int32_t CountScripts(); CXFA_Script GetScript(int32_t nIndex); }; + class CXFA_Bind : public CXFA_Data { public: - CXFA_Bind(CXFA_Node* pNode); + explicit CXFA_Bind(CXFA_Node* pNode); + int32_t GetMatch(); void GetRef(CFX_WideStringC& wsRef); void GetPicture(CFX_WideString& wsPicture); @@ -427,21 +424,26 @@ class CXFA_Bind : public CXFA_Data { FX_BOOL SetRef(const CFX_WideString& wsRef); FX_BOOL SetPicture(const CFX_WideString& wsPicture); }; + class CXFA_Assist : public CXFA_Data { public: - CXFA_Assist(CXFA_Node* pNode); + explicit CXFA_Assist(CXFA_Node* pNode); CXFA_ToolTip GetToolTip(); }; + class CXFA_ToolTip : public CXFA_Data { public: - CXFA_ToolTip(CXFA_Node* pNode); + explicit CXFA_ToolTip(CXFA_Node* pNode); + FX_BOOL GetTip(CFX_WideString& wsTip); FX_BOOL SetTip(const CFX_WideString& wsTip); }; + class CXFA_BindItems : public CXFA_Data { public: - CXFA_BindItems(CXFA_Node* pNode); + explicit CXFA_BindItems(CXFA_Node* pNode); + void GetConnection(CFX_WideStringC& wsConnection); void GetLabelRef(CFX_WideStringC& wsLabelRef); void GetValueRef(CFX_WideStringC& wsValueRef); @@ -451,82 +453,65 @@ class CXFA_BindItems : public CXFA_Data { FX_BOOL SetValueRef(const CFX_WideString& wsValueRef); FX_BOOL SetRef(const CFX_WideString& wsRef); }; + #define XFA_STROKE_SAMESTYLE_NoPresence 1 #define XFA_STROKE_SAMESTYLE_Corner 2 + class CXFA_Stroke : public CXFA_Data { public: - CXFA_Stroke(CXFA_Node* pNode) : CXFA_Data(pNode) {} + explicit CXFA_Stroke(CXFA_Node* pNode) : CXFA_Data(pNode) {} FX_BOOL IsCorner() const { return GetClassID() == XFA_ELEMENT_Corner; } - FX_BOOL IsEdge() const { return GetClassID() == XFA_ELEMENT_Edge; } - int32_t GetPresence() const; FX_BOOL IsVisible() const { return GetPresence() == XFA_ATTRIBUTEENUM_Visible; } int32_t GetCapType() const; - int32_t GetStrokeType() const; - FX_FLOAT GetThickness() const; CXFA_Measurement GetMSThickness() const; - void SetThickness(FX_FLOAT fThickness); void SetMSThickness(CXFA_Measurement msThinkness); - FX_ARGB GetColor() const; - void SetColor(FX_ARGB argb); - int32_t GetJoinType() const; - FX_BOOL IsInverted() const; - FX_FLOAT GetRadius() const; - FX_BOOL SameStyles(CXFA_Stroke stroke, FX_DWORD dwFlags = 0) const; }; + class CXFA_Corner : public CXFA_Stroke { public: - CXFA_Corner(CXFA_Node* pNode) : CXFA_Stroke(pNode) {} + explicit CXFA_Corner(CXFA_Node* pNode) : CXFA_Stroke(pNode) {} }; + class CXFA_Edge : public CXFA_Stroke { public: - CXFA_Edge(CXFA_Node* pNode) : CXFA_Stroke(pNode) {} + explicit CXFA_Edge(CXFA_Node* pNode) : CXFA_Stroke(pNode) {} }; + typedef CFX_ArrayTemplate<CXFA_Stroke> CXFA_StrokeArray; typedef CFX_ArrayTemplate<CXFA_Edge> CXFA_EdgeArray; typedef CFX_ArrayTemplate<CXFA_Corner> CXFA_CornerArray; + class CXFA_Box : public CXFA_Data { public: - CXFA_Box(CXFA_Node* pNode) : CXFA_Data(pNode) {} + explicit CXFA_Box(CXFA_Node* pNode) : CXFA_Data(pNode) {} FX_BOOL IsArc() const { return GetClassID() == XFA_ELEMENT_Arc; } - FX_BOOL IsBorder() const { return GetClassID() == XFA_ELEMENT_Border; } - FX_BOOL IsRectangle() const { return GetClassID() == XFA_ELEMENT_Rectangle; } - int32_t GetBreak() const; - int32_t GetHand() const; - int32_t GetPresence() const; - int32_t CountCorners() const; - CXFA_Corner GetCorner(int32_t nIndex) const; - int32_t CountEdges() const; - CXFA_Edge GetEdge(int32_t nIndex = 0) const; - void GetStrokes(CXFA_StrokeArray& strokes) const; - FX_BOOL IsCircular() const; - FX_BOOL GetStartAngle(FX_FLOAT& fStartAngle) const; FX_FLOAT GetStartAngle() const { FX_FLOAT fStartAngle; @@ -542,41 +527,44 @@ class CXFA_Box : public CXFA_Data { } CXFA_Fill GetFill(FX_BOOL bModified = FALSE) const; - CXFA_Margin GetMargin() const; - FX_BOOL SameStyles() const; - int32_t Get3DStyle(FX_BOOL& bVisible, FX_FLOAT& fThickness) const; }; + class CXFA_Arc : public CXFA_Box { public: - CXFA_Arc(CXFA_Node* pNode) : CXFA_Box(pNode) {} + explicit CXFA_Arc(CXFA_Node* pNode) : CXFA_Box(pNode) {} }; + class CXFA_Border : public CXFA_Box { public: - CXFA_Border(CXFA_Node* pNode) : CXFA_Box(pNode) {} + explicit CXFA_Border(CXFA_Node* pNode) : CXFA_Box(pNode) {} }; + class CXFA_Rectangle : public CXFA_Box { public: - CXFA_Rectangle(CXFA_Node* pNode) : CXFA_Box(pNode) {} + explicit CXFA_Rectangle(CXFA_Node* pNode) : CXFA_Box(pNode) {} }; + enum XFA_CHECKSTATE { XFA_CHECKSTATE_On = 0, XFA_CHECKSTATE_Off = 1, XFA_CHECKSTATE_Neutral = 2, }; + enum XFA_VALUEPICTURE { XFA_VALUEPICTURE_Raw = 0, XFA_VALUEPICTURE_Display, XFA_VALUEPICTURE_Edit, XFA_VALUEPICTURE_DataBind, }; + class CXFA_WidgetData : public CXFA_Data { public: - CXFA_WidgetData(CXFA_Node* pNode); - CXFA_Node* GetUIChild(); + explicit CXFA_WidgetData(CXFA_Node* pNode); + CXFA_Node* GetUIChild(); XFA_ELEMENT GetUIType(); CFX_WideString GetRawValue(); int32_t GetAccess(FX_BOOL bTemplate = FALSE); @@ -743,9 +731,11 @@ class CXFA_WidgetData : public CXFA_Data { CXFA_Node* m_pUiChildNode; XFA_ELEMENT m_eUIType; }; + class CXFA_Occur : public CXFA_Data { public: - CXFA_Occur(CXFA_Node* pNode); + explicit CXFA_Occur(CXFA_Node* pNode); + int32_t GetMax(); int32_t GetMin(); int32_t GetInitial(); @@ -753,9 +743,11 @@ class CXFA_Occur : public CXFA_Data { void SetMax(int32_t iMax); void SetMin(int32_t iMin); }; + class CXFA_Filter : public CXFA_Data { public: - CXFA_Filter(CXFA_Node* pNode) : CXFA_Data(pNode) {} + explicit CXFA_Filter(CXFA_Node* pNode) : CXFA_Data(pNode) {} + CFX_WideString GetFilterString(XFA_ATTRIBUTE eAttribute); XFA_ATTRIBUTEENUM GetAppearanceFilterType(); CFX_WideString GetAppearanceFilterContent(); @@ -776,70 +768,86 @@ class CXFA_Filter : public CXFA_Data { CFX_WideString GetlockDocumentContent(); int32_t GetMDPPermissions(); XFA_ATTRIBUTEENUM GetMDPSignatureType(); - CXFA_Reasons GetReasons(FX_BOOL bModified = FALSE); CFX_WideString GetTimeStampServer(); XFA_ATTRIBUTEENUM GetTimeStampType(); }; + class CXFA_Certificate : public CXFA_Data { public: - CXFA_Certificate(CXFA_Node* pNode) : CXFA_Data(pNode) {} + explicit CXFA_Certificate(CXFA_Node* pNode) : CXFA_Data(pNode) {} + CFX_WideString GetCertificateName(); CFX_WideString GetCertificateContent(); }; + class CXFA_WrapCertificate : public CXFA_Data { public: - CXFA_WrapCertificate(CXFA_Node* pNode) : CXFA_Data(pNode) {} + explicit CXFA_WrapCertificate(CXFA_Node* pNode) : CXFA_Data(pNode) {} + XFA_ATTRIBUTEENUM GetType(); int32_t CountCertificates(); CXFA_Certificate GetCertificate(int32_t nIndex); }; + class CXFA_Oids : public CXFA_Data { public: - CXFA_Oids(CXFA_Node* pNode) : CXFA_Data(pNode) {} + explicit CXFA_Oids(CXFA_Node* pNode) : CXFA_Data(pNode) {} + XFA_ATTRIBUTEENUM GetOidsType(); int32_t CountOids(); CFX_WideString GetOidContent(int32_t nIndex); }; + class CXFA_SubjectDNs : public CXFA_Data { public: - CXFA_SubjectDNs(CXFA_Node* pNode) : CXFA_Data(pNode) {} + explicit CXFA_SubjectDNs(CXFA_Node* pNode) : CXFA_Data(pNode) {} + XFA_ATTRIBUTEENUM GetSubjectDNsType(); int32_t CountSubjectDNs(); CFX_WideString GetSubjectDNString(int32_t nIndex, XFA_ATTRIBUTE eAttribute); CFX_WideString GetSubjectDNContent(int32_t nIndex); }; + class CXFA_DigestMethods : public CXFA_Data { public: - CXFA_DigestMethods(CXFA_Node* pNode) : CXFA_Data(pNode) {} + explicit CXFA_DigestMethods(CXFA_Node* pNode) : CXFA_Data(pNode) {} + XFA_ATTRIBUTEENUM GetDigestMethodsType(); int32_t CountDigestMethods(); CFX_WideString GetDigestMethodContent(int32_t nIndex); }; + class CXFA_Encodings : public CXFA_Data { public: - CXFA_Encodings(CXFA_Node* pNode) : CXFA_Data(pNode) {} + explicit CXFA_Encodings(CXFA_Node* pNode) : CXFA_Data(pNode) {} + XFA_ATTRIBUTEENUM GetEncodingsType(); int32_t CountEncodings(); CFX_WideString GetEncodingContent(int32_t nIndex); }; + class CXFA_EncryptionMethods : public CXFA_Data { public: - CXFA_EncryptionMethods(CXFA_Node* pNode) : CXFA_Data(pNode) {} + explicit CXFA_EncryptionMethods(CXFA_Node* pNode) : CXFA_Data(pNode) {} XFA_ATTRIBUTEENUM GetEncryptionMethodsType(); int32_t CountEncryptionMethods(); CFX_WideString GetEncryptionMethodContent(int32_t nIndex); }; + class CXFA_Reasons : public CXFA_Data { public: - CXFA_Reasons(CXFA_Node* pNode) : CXFA_Data(pNode) {} + explicit CXFA_Reasons(CXFA_Node* pNode) : CXFA_Data(pNode) {} + XFA_ATTRIBUTEENUM GetReasonsType(); int32_t CountReasons(); CFX_WideString GetReasonContent(int32_t nIndex); }; + class CXFA_Manifest : public CXFA_Data { public: - CXFA_Manifest(CXFA_Node* pNode) : CXFA_Data(pNode) {} + explicit CXFA_Manifest(CXFA_Node* pNode) : CXFA_Data(pNode) {} + XFA_ATTRIBUTEENUM GetAction(); int32_t CountReives(); CFX_WideString GetRefContent(int32_t nIndex); diff --git a/xfa/src/fxfa/src/app/xfa_ffcheckbutton.cpp b/xfa/src/fxfa/src/app/xfa_ffcheckbutton.cpp index 2b0f3dc7ea..d18b84aff8 100644 --- a/xfa/src/fxfa/src/app/xfa_ffcheckbutton.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffcheckbutton.cpp @@ -87,13 +87,13 @@ FX_BOOL CXFA_FFCheckButton::PerformLayout() { CXFA_Margin mgWidget = m_pDataAcc->GetMargin(); CFX_RectF rtWidget; GetRectWithoutRotate(rtWidget); - if (mgWidget.IsExistInXML()) { + if (mgWidget) { XFA_RectWidthoutMargin(rtWidget, mgWidget); } int32_t iCapPlacement = -1; FX_FLOAT fCapReserve = 0; CXFA_Caption caption = m_pDataAcc->GetCaption(); - if (caption.IsExistInXML() && caption.GetPresence()) { + if (caption && caption.GetPresence()) { m_rtCaption.Set(rtWidget.left, rtWidget.top, rtWidget.width, rtWidget.height); iCapPlacement = caption.GetPlacementType(); @@ -163,7 +163,7 @@ FX_BOOL CXFA_FFCheckButton::PerformLayout() { CXFA_Border borderUI = m_pDataAcc->GetUIBorder(); if (borderUI) { CXFA_Margin margin = borderUI.GetMargin(); - if (margin.IsExistInXML()) { + if (margin) { XFA_RectWidthoutMargin(m_rtUI, margin); } } diff --git a/xfa/src/fxfa/src/app/xfa_ffdocview.cpp b/xfa/src/fxfa/src/app/xfa_ffdocview.cpp index e71820b92f..5232d19417 100644 --- a/xfa/src/fxfa/src/app/xfa_ffdocview.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffdocview.cpp @@ -226,7 +226,7 @@ FX_BOOL CXFA_FFDocView::ResetSingleWidgetAccData(CXFA_WidgetAcc* pWidgetAcc) { } if (CXFA_Validate validate = pWidgetAcc->GetValidate()) { AddValidateWidget(pWidgetAcc); - ((CXFA_Node*)validate)->SetFlag(XFA_NODEFLAG_NeedsInitApp, TRUE, FALSE); + validate.GetNode()->SetFlag(XFA_NODEFLAG_NeedsInitApp, TRUE, FALSE); } return TRUE; } diff --git a/xfa/src/fxfa/src/app/xfa_fffield.cpp b/xfa/src/fxfa/src/app/xfa_fffield.cpp index 78026c7c00..e21b5fd260 100644 --- a/xfa/src/fxfa/src/app/xfa_fffield.cpp +++ b/xfa/src/fxfa/src/app/xfa_fffield.cpp @@ -185,8 +185,7 @@ void CXFA_FFField::CapPlacement() { XFA_ATTRIBUTEENUM iCapPlacement = XFA_ATTRIBUTEENUM_Unknown; FX_FLOAT fCapReserve = 0; CXFA_Caption caption = m_pDataAcc->GetCaption(); - if (caption.IsExistInXML() && - caption.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) { + if (caption && caption.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) { iCapPlacement = (XFA_ATTRIBUTEENUM)caption.GetPlacementType(); if (iCapPlacement == XFA_ATTRIBUTEENUM_Top && GetPrev()) { m_rtCaption.Set(0, 0, 0, 0); @@ -262,7 +261,7 @@ void CXFA_FFField::CapPlacement() { CXFA_Border borderUI = m_pDataAcc->GetUIBorder(); if (borderUI) { CXFA_Margin margin = borderUI.GetMargin(); - if (margin.IsExistInXML()) { + if (margin) { XFA_RectWidthoutMargin(m_rtUI, margin); } } @@ -659,8 +658,7 @@ void CXFA_FFField::RenderCaption(CFX_Graphics* pGS, CFX_Matrix* pMatrix) { return; } CXFA_Caption caption = m_pDataAcc->GetCaption(); - if (caption.IsExistInXML() && - caption.GetPresence() == XFA_ATTRIBUTEENUM_Visible) { + if (caption && caption.GetPresence() == XFA_ATTRIBUTEENUM_Visible) { if (!pCapTextLayout->IsLoaded()) { CFX_SizeF size; size.Set(m_rtCaption.width, m_rtCaption.height); diff --git a/xfa/src/fxfa/src/app/xfa_ffpath.cpp b/xfa/src/fxfa/src/app/xfa_ffpath.cpp index 5d0f5be5d1..8217af29a7 100644 --- a/xfa/src/fxfa/src/app/xfa_ffpath.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffpath.cpp @@ -65,7 +65,7 @@ void CXFA_FFLine::RenderWidget(CFX_Graphics* pGS, FX_BOOL bSlope = lineObj.GetSlop(); int32_t iCap = 0; CXFA_Edge edge = lineObj.GetEdge(); - if (edge.IsExistInXML()) { + if (edge) { if (edge.GetPresence() != XFA_ATTRIBUTEENUM_Visible) { return; } diff --git a/xfa/src/fxfa/src/app/xfa_ffpushbutton.cpp b/xfa/src/fxfa/src/app/xfa_ffpushbutton.cpp index efbde646a6..2b9f1eeb95 100644 --- a/xfa/src/fxfa/src/app/xfa_ffpushbutton.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffpushbutton.cpp @@ -122,8 +122,7 @@ FX_BOOL CXFA_FFPushButton::PerformLayout() { } FX_FLOAT CXFA_FFPushButton::GetLineWidth() { CXFA_Border border = m_pDataAcc->GetBorder(); - if (border.IsExistInXML() && - (border.GetPresence() == XFA_ATTRIBUTEENUM_Visible)) { + if (border && border.GetPresence() == XFA_ATTRIBUTEENUM_Visible) { CXFA_Edge edge = border.GetEdge(0); return edge.GetThickness(); } @@ -137,8 +136,7 @@ FX_ARGB CXFA_FFPushButton::GetFillColor() { } void CXFA_FFPushButton::LoadHighlightCaption() { CXFA_Caption caption = m_pDataAcc->GetCaption(); - if (caption.IsExistInXML() && - caption.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) { + if (caption && caption.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) { { CFX_WideString wsRollover; FX_BOOL bRichText; @@ -175,8 +173,7 @@ void CXFA_FFPushButton::RenderHighlightCaption(CFX_Graphics* pGS, CFX_Matrix* pMatrix) { CXFA_TextLayout* pCapTextLayout = m_pDataAcc->GetCaptionTextLayout(); CXFA_Caption caption = m_pDataAcc->GetCaption(); - if (caption.IsExistInXML() && - caption.GetPresence() == XFA_ATTRIBUTEENUM_Visible) { + if (caption && caption.GetPresence() == XFA_ATTRIBUTEENUM_Visible) { CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice(); CFX_RectF rtWidget; GetRectWithoutRotate(rtWidget); diff --git a/xfa/src/fxfa/src/app/xfa_ffwidget.cpp b/xfa/src/fxfa/src/app/xfa_ffwidget.cpp index f97e272b04..0af2ede0e6 100644 --- a/xfa/src/fxfa/src/app/xfa_ffwidget.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffwidget.cpp @@ -106,7 +106,7 @@ void CXFA_FFWidget::RenderWidget(CFX_Graphics* pGS, CFX_RectF rtBorder; GetRectWithoutRotate(rtBorder); CXFA_Margin margin = border.GetMargin(); - if (margin.IsExistInXML()) { + if (margin) { XFA_RectWidthoutMargin(rtBorder, margin); } rtBorder.Normalize(); @@ -1151,8 +1151,8 @@ static void XFA_BOX_GetPath(CXFA_Box box, CFX_PointF cpStart, cp, cp1, cp2; CFX_RectF rtRadius; int32_t n = (nIndex & 1) ? nIndex - 1 : nIndex; - CXFA_Corner corner1 = (CXFA_Node*)strokes[n]; - CXFA_Corner corner2 = (CXFA_Node*)strokes[(n + 2) % 8]; + CXFA_Corner corner1(strokes[n].GetNode()); + CXFA_Corner corner2(strokes[(n + 2) % 8].GetNode()); fRadius1 = bCorner ? corner1.GetRadius() : 0; fRadius2 = bCorner ? corner2.GetRadius() : 0; bInverted = corner1.IsInverted(); @@ -1362,8 +1362,8 @@ static void XFA_BOX_GetFillPath(CXFA_Box box, CFX_PointF cp, cp1, cp2; CFX_RectF rtRadius; for (int32_t i = 0; i < 8; i += 2) { - CXFA_Corner corner1 = (CXFA_Node*)strokes[i]; - CXFA_Corner corner2 = (CXFA_Node*)strokes[(i + 2) % 8]; + CXFA_Corner corner1(strokes[i].GetNode()); + CXFA_Corner corner2(strokes[(i + 2) % 8].GetNode()); fRadius1 = corner1.GetRadius(); fRadius2 = corner2.GetRadius(); bInverted = corner1.IsInverted(); @@ -1548,7 +1548,7 @@ static void XFA_BOX_Fill(CXFA_Box box, CFX_Matrix* pMatrix, FX_DWORD dwFlags) { CXFA_Fill fill = box.GetFill(); - if (!fill.IsExistInXML() || fill.GetPresence() != XFA_ATTRIBUTEENUM_Visible) { + if (!fill || fill.GetPresence() != XFA_ATTRIBUTEENUM_Visible) { return; } pGS->SaveGraphState(); @@ -1593,7 +1593,7 @@ static void XFA_BOX_StrokePath(CXFA_Stroke stroke, CFX_Path* pPath, CFX_Graphics* pGS, CFX_Matrix* pMatrix) { - if (!stroke.IsExistInXML() || !stroke.IsVisible()) { + if (!stroke || !stroke.IsVisible()) { return; } FX_FLOAT fThickness = stroke.GetThickness(); @@ -1619,7 +1619,7 @@ static void XFA_BOX_StrokeArc(CXFA_Box box, CFX_Matrix* pMatrix, FX_DWORD dwFlags) { CXFA_Edge edge = box.GetEdge(0); - if (!edge.IsExistInXML() || !edge.IsVisible()) { + if (!edge || !edge.IsVisible()) { return; } FX_BOOL bVisible = FALSE; @@ -1893,7 +1893,7 @@ static void XFA_BOX_Stroke(CXFA_Box box, return; } for (int32_t i = 1; i < 8; i += 2) { - CXFA_Edge edge = (CXFA_Node*)strokes[i]; + CXFA_Edge edge(strokes[i].GetNode()); FX_FLOAT fThickness = edge.GetThickness(); if (fThickness < 0) { fThickness = 0; diff --git a/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp b/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp index 8ce46516a6..05ffefdf5d 100644 --- a/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp @@ -126,8 +126,7 @@ class CXFA_FieldLayoutData : public CXFA_WidgetLayoutData { return TRUE; } CXFA_Caption caption = pAcc->GetCaption(); - if (caption.IsExistInXML() && - caption.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) { + if (caption && caption.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) { m_pCapTextProvider = new CXFA_TextProvider(pAcc, XFA_TEXTPROVIDERTYPE_Caption); m_pCapTextLayout = new CXFA_TextLayout(m_pCapTextProvider); @@ -594,7 +593,7 @@ int32_t CXFA_WidgetAcc::ProcessValidate(int32_t iFlags) { if (!validate) { return XFA_EVENTERROR_NotExist; } - FX_BOOL bInitDoc = ((CXFA_Node*)validate)->HasFlag(XFA_NODEFLAG_NeedsInitApp); + FX_BOOL bInitDoc = validate.GetNode()->HasFlag(XFA_NODEFLAG_NeedsInitApp); FX_BOOL bStatus = m_pDocView->GetLayoutStatus() < XFA_DOCVIEW_LAYOUTSTATUS_End; int32_t iFormat = 0; @@ -616,7 +615,7 @@ int32_t CXFA_WidgetAcc::ProcessValidate(int32_t iFlags) { bVersionFlag = TRUE; } if (bInitDoc) { - ((CXFA_Node*)validate)->SetFlag(XFA_NODEFLAG_NeedsInitApp, FALSE, FALSE); + validate.GetNode()->SetFlag(XFA_NODEFLAG_NeedsInitApp, FALSE, FALSE); } else { iFormat = ProcessFormatTestValidate(validate, bVersionFlag); if (!bVersionFlag) { @@ -760,8 +759,7 @@ void CXFA_WidgetAcc::NotifyEvent(FX_DWORD dwEvent, } void CXFA_WidgetAcc::CalcCaptionSize(CFX_SizeF& szCap) { CXFA_Caption caption = this->GetCaption(); - if (!caption.IsExistInXML() || - caption.GetPresence() != XFA_ATTRIBUTEENUM_Visible) { + if (!caption || caption.GetPresence() != XFA_ATTRIBUTEENUM_Visible) { return; } LoadCaption(); @@ -842,7 +840,7 @@ FX_BOOL CXFA_WidgetAcc::CalculateFieldAutoSize(CFX_SizeF& size) { } FX_BOOL CXFA_WidgetAcc::CalculateWidgetAutoSize(CFX_SizeF& size) { CXFA_Margin mgWidget = this->GetMargin(); - if (mgWidget.IsExistInXML()) { + if (mgWidget) { FX_FLOAT fLeftInset, fTopInset, fRightInset, fBottomInset; mgWidget.GetLeftInset(fLeftInset); mgWidget.GetTopInset(fTopInset); @@ -852,7 +850,7 @@ FX_BOOL CXFA_WidgetAcc::CalculateWidgetAutoSize(CFX_SizeF& size) { size.y += fTopInset + fBottomInset; } CXFA_Para para = this->GetPara(); - if (para.IsExistInXML()) { + if (para) { size.x += para.GetMarginLeft(); size.x += para.GetTextIndent(); } @@ -933,7 +931,7 @@ FX_BOOL CXFA_WidgetAcc::CalculateTextEditAutoSize(CFX_SizeF& size) { GetUIMargin(rtUIMargin); size.x -= rtUIMargin.left + rtUIMargin.width; CXFA_Margin mgWidget = this->GetMargin(); - if (mgWidget.IsExistInXML()) { + if (mgWidget) { FX_FLOAT fLeftInset, fRightInset; mgWidget.GetLeftInset(fLeftInset); mgWidget.GetRightInset(fRightInset); @@ -1065,7 +1063,7 @@ void CXFA_WidgetAcc::LoadText() { } FX_FLOAT CXFA_WidgetAcc::CalculateWidgetAutoWidth(FX_FLOAT fWidthCalc) { CXFA_Margin mgWidget = this->GetMargin(); - if (mgWidget.IsExistInXML()) { + if (mgWidget) { FX_FLOAT fLeftInset, fRightInset; mgWidget.GetLeftInset(fLeftInset); mgWidget.GetRightInset(fRightInset); @@ -1082,7 +1080,7 @@ FX_FLOAT CXFA_WidgetAcc::CalculateWidgetAutoWidth(FX_FLOAT fWidthCalc) { } FX_FLOAT CXFA_WidgetAcc::GetWidthWithoutMargin(FX_FLOAT fWidthCalc) { CXFA_Margin mgWidget = this->GetMargin(); - if (mgWidget.IsExistInXML()) { + if (mgWidget) { FX_FLOAT fLeftInset, fRightInset; mgWidget.GetLeftInset(fLeftInset); mgWidget.GetRightInset(fRightInset); @@ -1092,7 +1090,7 @@ FX_FLOAT CXFA_WidgetAcc::GetWidthWithoutMargin(FX_FLOAT fWidthCalc) { } FX_FLOAT CXFA_WidgetAcc::CalculateWidgetAutoHeight(FX_FLOAT fHeightCalc) { CXFA_Margin mgWidget = this->GetMargin(); - if (mgWidget.IsExistInXML()) { + if (mgWidget) { FX_FLOAT fTopInset, fBottomInset; mgWidget.GetTopInset(fTopInset); mgWidget.GetBottomInset(fBottomInset); @@ -1109,7 +1107,7 @@ FX_FLOAT CXFA_WidgetAcc::CalculateWidgetAutoHeight(FX_FLOAT fHeightCalc) { } FX_FLOAT CXFA_WidgetAcc::GetHeightWithoutMargin(FX_FLOAT fHeightCalc) { CXFA_Margin mgWidget = this->GetMargin(); - if (mgWidget.IsExistInXML()) { + if (mgWidget) { FX_FLOAT fTopInset, fBottomInset; mgWidget.GetTopInset(fTopInset); mgWidget.GetBottomInset(fBottomInset); @@ -1206,7 +1204,7 @@ FX_BOOL CXFA_WidgetAcc::FindSplitPos(int32_t iBlockIndex, FX_FLOAT fBottomInset = 0; if (iBlockIndex == 0) { CXFA_Margin mgWidget = this->GetMargin(); - if (mgWidget.IsExistInXML()) { + if (mgWidget) { mgWidget.GetTopInset(fTopInset); mgWidget.GetBottomInset(fBottomInset); } @@ -1241,8 +1239,7 @@ FX_BOOL CXFA_WidgetAcc::FindSplitPos(int32_t iBlockIndex, FX_FLOAT fCapReserve = 0; if (iBlockIndex == 0) { CXFA_Caption caption = GetCaption(); - if (caption.IsExistInXML() && - caption.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) { + if (caption && caption.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) { iCapPlacement = (XFA_ATTRIBUTEENUM)caption.GetPlacementType(); fCapReserve = caption.GetReserve(); } @@ -1665,7 +1662,7 @@ CXFA_Para CXFA_TextProvider::GetParaNode() { return m_pWidgetAcc->GetPara(); } CXFA_Node* pNode = m_pWidgetAcc->GetNode()->GetChild(0, XFA_ELEMENT_Caption); - return pNode->GetChild(0, XFA_ELEMENT_Para); + return CXFA_Para(pNode->GetChild(0, XFA_ELEMENT_Para)); } CXFA_Font CXFA_TextProvider::GetFontNode() { if (m_eType == XFA_TEXTPROVIDERTYPE_Text) { @@ -1674,7 +1671,7 @@ CXFA_Font CXFA_TextProvider::GetFontNode() { CXFA_Node* pNode = m_pWidgetAcc->GetNode()->GetChild(0, XFA_ELEMENT_Caption); pNode = pNode->GetChild(0, XFA_ELEMENT_Font); if (pNode) { - return pNode; + return CXFA_Font(pNode); } return m_pWidgetAcc->GetFont(); } diff --git a/xfa/src/fxfa/src/app/xfa_textlayout.cpp b/xfa/src/fxfa/src/app/xfa_textlayout.cpp index b949734fe9..8cef856224 100644 --- a/xfa/src/fxfa/src/app/xfa_textlayout.cpp +++ b/xfa/src/fxfa/src/app/xfa_textlayout.cpp @@ -104,7 +104,7 @@ void CXFA_TextParser::InitCSSData(IXFA_TextProvider* pTextProvider) { m_pSelector->SetFontMgr(pFontMgr); FX_FLOAT fFontSize = 10; CXFA_Font font = pTextProvider->GetFontNode(); - if (font.IsExistInXML()) { + if (font) { fFontSize = font.GetFontSize(); } m_pSelector->SetDefFontSize(fFontSize); @@ -136,7 +136,7 @@ IFDE_CSSComputedStyle* CXFA_TextParser::CreateRootStyle( IFDE_CSSFontStyle* pFontStyle = pStyle->GetFontStyles(); IFDE_CSSParagraphStyle* pParaStyle = pStyle->GetParagraphStyles(); FX_FLOAT fLineHeight = 0, fFontSize = 10; - if (para.IsExistInXML()) { + if (para) { fLineHeight = para.GetLineHeight(); FDE_CSSLENGTH indent; indent.Set(FDE_CSSLENGTHUNIT_Point, para.GetTextIndent()); @@ -164,7 +164,7 @@ IFDE_CSSComputedStyle* CXFA_TextParser::CreateRootStyle( rtMarginWidth.bottom.Set(FDE_CSSLENGTHUNIT_Point, para.GetSpaceBelow()); pStyle->GetBoundaryStyles()->SetMarginWidth(rtMarginWidth); } - if (font.IsExistInXML()) { + if (font) { pFontStyle->SetColor(font.GetColor()); pFontStyle->SetFontStyle(font.IsItalic() ? FDE_CSSFONTSTYLE_Italic : FDE_CSSFONTSTYLE_Normal); @@ -324,7 +324,7 @@ void CXFA_TextParser::ParseTagInfo(IFDE_XMLNode* pXMLNode, int32_t CXFA_TextParser::GetVAlgin(IXFA_TextProvider* pTextProvider) const { int32_t iAlign = XFA_ATTRIBUTEENUM_Top; CXFA_Para para = pTextProvider->GetParaNode(); - if (para.IsExistInXML()) { + if (para) { iAlign = para.GetVerticalAlign(); } return iAlign; @@ -357,7 +357,7 @@ IFX_Font* CXFA_TextParser::GetFont(IXFA_TextProvider* pTextProvider, CFX_WideStringC wsFamily = FX_WSTRC(L"Courier"); FX_DWORD dwStyle = 0; CXFA_Font font = pTextProvider->GetFontNode(); - if (font.IsExistInXML()) { + if (font) { font.GetTypeface(wsFamily); if (font.IsBold()) { dwStyle |= FX_FONTSTYLE_Bold; @@ -391,7 +391,7 @@ FX_FLOAT CXFA_TextParser::GetFontSize(IXFA_TextProvider* pTextProvider, return pStyle->GetFontStyles()->GetFontSize(); } CXFA_Font font = pTextProvider->GetFontNode(); - if (font.IsExistInXML()) { + if (font) { return font.GetFontSize(); } return 10; @@ -457,7 +457,7 @@ void CXFA_TextParser::GetUnderline(IXFA_TextProvider* pTextProvider, } } else { CXFA_Font font = pTextProvider->GetFontNode(); - if (font.IsExistInXML()) { + if (font) { iUnderline = font.GetUnderline(); iPeriod = font.GetUnderlinePeriod(); } @@ -471,7 +471,7 @@ void CXFA_TextParser::GetLinethrough(IXFA_TextProvider* pTextProvider, iLinethrough = (dwDecoration & FDE_CSSTEXTDECORATION_LineThrough) ? 1 : 0; } else { CXFA_Font font = pTextProvider->GetFontNode(); - if (font.IsExistInXML()) { + if (font) { iLinethrough = font.GetLineThrough(); } } @@ -761,7 +761,7 @@ void CXFA_TextLayout::InitBreak(FX_FLOAT fLineWidth) { CXFA_Para para = m_pTextProvider->GetParaNode(); FX_FLOAT fStart = 0; FX_FLOAT fStartPos = 0; - if (para.IsExistInXML()) { + if (para) { int32_t iAlign = FX_RTFLINEALIGNMENT_Left; switch (para.GetHorizontalAlign()) { case XFA_ATTRIBUTEENUM_Center: @@ -797,7 +797,7 @@ void CXFA_TextLayout::InitBreak(FX_FLOAT fLineWidth) { } m_pBreak->SetLineBoundary(fStart, fLineWidth); m_pBreak->SetLineStartPos(fStartPos); - if (font.IsExistInXML()) { + if (font) { m_pBreak->SetHorizontalScale((int32_t)font.GetHorizontalScale()); m_pBreak->SetVerticalScale((int32_t)font.GetVerticalScale()); m_pBreak->SetCharSpace(font.GetLetterSpacing()); @@ -1347,7 +1347,7 @@ void CXFA_TextLayout::LoadText(CXFA_Node* pNode, InitBreak(szText.x); CXFA_Para para = m_pTextProvider->GetParaNode(); FX_FLOAT fSpaceAbove = 0; - if (para.IsExistInXML()) { + if (para) { fSpaceAbove = para.GetSpaceAbove(); if (fSpaceAbove < 0.1f) { fSpaceAbove = 0; @@ -1830,7 +1830,7 @@ void CXFA_TextLayout::AppendTextLine(FX_DWORD dwStatus, m_pBreak->Reset(); if (!pStyle && bEndBreak) { CXFA_Para para = m_pTextProvider->GetParaNode(); - if (para.IsExistInXML()) { + if (para) { FX_FLOAT fStartPos = para.GetMarginLeft(); FX_FLOAT fIndent = para.GetTextIndent(); if (fIndent > 0) { diff --git a/xfa/src/fxfa/src/parser/xfa_document_datamerger_imp.cpp b/xfa/src/fxfa/src/parser/xfa_document_datamerger_imp.cpp index 6d1ba3b84e..058ed483d0 100644 --- a/xfa/src/fxfa/src/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/src/fxfa/src/parser/xfa_document_datamerger_imp.cpp @@ -109,7 +109,7 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, FXSYS_assert(pWidgetData); FX_BOOL bNotify = FALSE; XFA_ELEMENT eUIType = pWidgetData->GetUIType(); - CXFA_Value defValue = pFormNode->GetProperty(0, XFA_ELEMENT_Value); + CXFA_Value defValue(pFormNode->GetProperty(0, XFA_ELEMENT_Value)); if (!bDataToForm) { CFX_WideString wsValue; CFX_WideString wsFormatedValue; @@ -294,7 +294,7 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, wsNormailizeValue += wsItem; } CXFA_ExData exData = defValue.GetExData(); - FXSYS_assert(exData != NULL); + FXSYS_assert(exData); exData.SetContentType((iCounts == 1) ? FX_WSTRC(L"text/plain") : FX_WSTRC(L"text/xml")); } diff --git a/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp b/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp index 8e9da4d3bf..cbfdb09fc4 100644 --- a/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp +++ b/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp @@ -3010,7 +3010,7 @@ FX_BOOL CXFA_ItemLayoutProcessor::JudgeLeaderOrTrailerForOccur( if (!pTemplate) { pTemplate = pFormNode; } - CXFA_Occur NodeOccur = pTemplate->GetFirstChildByClass(XFA_ELEMENT_Occur); + CXFA_Occur NodeOccur(pTemplate->GetFirstChildByClass(XFA_ELEMENT_Occur)); int32_t iMax = NodeOccur.GetMax(); if (iMax > -1) { int32_t iCount = diff --git a/xfa/src/fxfa/src/parser/xfa_object_imp.cpp b/xfa/src/fxfa/src/parser/xfa_object_imp.cpp index ed79e08b94..1829ffdb67 100644 --- a/xfa/src/fxfa/src/parser/xfa_object_imp.cpp +++ b/xfa/src/fxfa/src/parser/xfa_object_imp.cpp @@ -1902,7 +1902,7 @@ void CXFA_Node::Script_Som_FillColor(FXJSE_HVALUE hValue, } CXFA_Border border = pWidgetData->GetBorder(TRUE); CXFA_Fill borderfill = border.GetFill(TRUE); - CXFA_Node* pNode = (CXFA_Node*)borderfill; + CXFA_Node* pNode = borderfill.GetNode(); if (!pNode) { return; } @@ -2060,7 +2060,7 @@ void CXFA_Node::Script_Som_FontColor(FXJSE_HVALUE hValue, return; } CXFA_Font font = pWidgetData->GetFont(TRUE); - CXFA_Node* pNode = (CXFA_Node*)font; + CXFA_Node* pNode = font.GetNode(); if (!pNode) { return; } @@ -2808,10 +2808,9 @@ void CXFA_Node::Script_InstanceManager_Max(FXJSE_HVALUE hValue, if (bSetting) { ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); return; - } else { - CXFA_Occur nodeOccur = GetOccurNode(); - FXJSE_Value_SetInteger(hValue, nodeOccur.GetMax()); } + CXFA_Occur nodeOccur(GetOccurNode()); + FXJSE_Value_SetInteger(hValue, nodeOccur.GetMax()); } void CXFA_Node::Script_InstanceManager_Min(FXJSE_HVALUE hValue, FX_BOOL bSetting, @@ -2819,10 +2818,9 @@ void CXFA_Node::Script_InstanceManager_Min(FXJSE_HVALUE hValue, if (bSetting) { ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); return; - } else { - CXFA_Occur nodeOccur = GetOccurNode(); - FXJSE_Value_SetInteger(hValue, nodeOccur.GetMin()); } + CXFA_Occur nodeOccur(GetOccurNode()); + FXJSE_Value_SetInteger(hValue, nodeOccur.GetMin()); } static int32_t XFA_ScriptInstanceManager_GetCount(CXFA_Node* pInstMgrNode) { ASSERT(pInstMgrNode); @@ -3167,7 +3165,7 @@ void CXFA_Node::Script_InstanceManager_RemoveInstance( ThrowScriptErrorMessage(XFA_IDS_INDEX_OUT_OF_BOUNDS); return; } - CXFA_Occur nodeOccur = GetOccurNode(); + CXFA_Occur nodeOccur(GetOccurNode()); int32_t iMin = nodeOccur.GetMin(); if (iCount - 1 < iMin) { ThrowScriptErrorMessage(XFA_IDS_VIOLATE_BOUNDARY, L"min"); @@ -3214,7 +3212,7 @@ void CXFA_Node::Script_InstanceManager_AddInstance( fFlags = pArguments->GetInt32(0) == 0 ? FALSE : TRUE; } int32_t iCount = XFA_ScriptInstanceManager_GetCount(this); - CXFA_Occur nodeOccur = GetOccurNode(); + CXFA_Occur nodeOccur(GetOccurNode()); int32_t iMax = nodeOccur.GetMax(); if (iMax >= 0 && iCount >= iMax) { ThrowScriptErrorMessage(XFA_IDS_VIOLATE_BOUNDARY, L"max"); @@ -3252,7 +3250,7 @@ void CXFA_Node::Script_InstanceManager_InsertInstance( if (argc == 2) { bBind = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; } - CXFA_Occur nodeOccur = GetOccurNode(); + CXFA_Occur nodeOccur(GetOccurNode()); int32_t iCount = XFA_ScriptInstanceManager_GetCount(this); if (iIndex < 0 || iIndex > iCount) { ThrowScriptErrorMessage(XFA_IDS_INDEX_OUT_OF_BOUNDS); @@ -3283,7 +3281,7 @@ void CXFA_Node::Script_InstanceManager_InsertInstance( (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Form)); } int32_t CXFA_Node::InstanceManager_SetInstances(int32_t iDesired) { - CXFA_Occur nodeOccur = GetOccurNode(); + CXFA_Occur nodeOccur(GetOccurNode()); int32_t iMax = nodeOccur.GetMax(); int32_t iMin = nodeOccur.GetMin(); if (iDesired < iMin) { diff --git a/xfa/src/fxfa/src/parser/xfa_objectacc_imp.cpp b/xfa/src/fxfa/src/parser/xfa_objectacc_imp.cpp index c9bf21f0c5..e34220b30c 100644 --- a/xfa/src/fxfa/src/parser/xfa_objectacc_imp.cpp +++ b/xfa/src/fxfa/src/parser/xfa_objectacc_imp.cpp @@ -323,14 +323,12 @@ FX_BOOL CXFA_Font::IsUseKerning() { return eAttr == XFA_ATTRIBUTEENUM_Pair; } void CXFA_Font::SetColor(FX_ARGB color) { - CXFA_Fill fill = m_pNode->GetProperty(0, XFA_ELEMENT_Fill); + CXFA_Fill fill(m_pNode->GetProperty(0, XFA_ELEMENT_Fill)); fill.SetColor(color); } FX_ARGB CXFA_Font::GetColor() { - if (CXFA_Fill fill = m_pNode->GetChild(0, XFA_ELEMENT_Fill)) { - return fill.GetColor(TRUE); - } - return 0xFF000000; + CXFA_Fill fill(m_pNode->GetChild(0, XFA_ELEMENT_Fill)); + return fill ? fill.GetColor(TRUE) : 0xFF000000; } FX_BOOL CXFA_Font::SetBaselineShift(FX_FLOAT fBaselineShift) { CXFA_Measurement ms(fBaselineShift, XFA_UNIT_Pt); @@ -580,10 +578,10 @@ void CXFA_Event::GetExecuteConnection(CFX_WideString& wsConnection) { wsConnection = cData; } CXFA_Script CXFA_Event::GetScript() { - return m_pNode->GetChild(0, XFA_ELEMENT_Script); + return CXFA_Script(m_pNode->GetChild(0, XFA_ELEMENT_Script)); } CXFA_Submit CXFA_Event::GetSubmit() { - return m_pNode->GetChild(0, XFA_ELEMENT_Submit); + return CXFA_Submit(m_pNode->GetChild(0, XFA_ELEMENT_Submit)); } int32_t CXFA_Event::GetSignDataOperation() { CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_ELEMENT_SignData); @@ -787,28 +785,29 @@ FX_BOOL CXFA_Value::GetChildValueContent(CFX_WideString& wsContent) { return FALSE; } CXFA_Arc CXFA_Value::GetArc() { - return m_pNode ? CXFA_Arc(m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)) - : NULL; + return CXFA_Arc(m_pNode ? m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild) + : nullptr); } CXFA_Line CXFA_Value::GetLine() { - return m_pNode ? CXFA_Line(m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)) - : NULL; + return CXFA_Line(m_pNode ? m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild) + : nullptr); } CXFA_Rectangle CXFA_Value::GetRectangle() { - return m_pNode ? CXFA_Rectangle(m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)) - : NULL; + return CXFA_Rectangle(m_pNode ? m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild) + : nullptr); } CXFA_Text CXFA_Value::GetText() { - return m_pNode ? CXFA_Text(m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)) - : NULL; + return CXFA_Text(m_pNode ? m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild) + : nullptr); } CXFA_ExData CXFA_Value::GetExData() { - return m_pNode ? CXFA_ExData(m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)) - : NULL; + return CXFA_ExData(m_pNode ? m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild) + : nullptr); } CXFA_Image CXFA_Value::GetImage() { return CXFA_Image( - m_pNode ? (m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)) : NULL, TRUE); + m_pNode ? (m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)) : nullptr, + TRUE); } FX_BOOL CXFA_Value::SetChildValueContent(const CFX_WideString& wsContent, FX_BOOL bNotify, @@ -980,7 +979,7 @@ int32_t CXFA_Calculate::GetOverride() { return eAtt; } CXFA_Script CXFA_Calculate::GetScript() { - return m_pNode->GetChild(0, XFA_ELEMENT_Script); + return CXFA_Script(m_pNode->GetChild(0, XFA_ELEMENT_Script)); } void CXFA_Calculate::GetMessageText(CFX_WideString& wsMessage) { if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_ELEMENT_Message)) { @@ -1092,14 +1091,14 @@ void CXFA_Validate::GetPicture(CFX_WideString& wsPicture) { } } CXFA_Script CXFA_Validate::GetScript() { - return m_pNode->GetChild(0, XFA_ELEMENT_Script); + return CXFA_Script(m_pNode->GetChild(0, XFA_ELEMENT_Script)); } CXFA_Variables::CXFA_Variables(CXFA_Node* pNode) : CXFA_Data(pNode) {} int32_t CXFA_Variables::CountScripts() { return m_pNode->CountChildren(XFA_ELEMENT_Script); } CXFA_Script CXFA_Variables::GetScript(int32_t nIndex) { - return m_pNode->GetChild(nIndex, XFA_ELEMENT_Script); + return CXFA_Script(m_pNode->GetChild(nIndex, XFA_ELEMENT_Script)); } CXFA_Bind::CXFA_Bind(CXFA_Node* pNode) : CXFA_Data(pNode) {} int32_t CXFA_Bind::GetMatch() { @@ -1127,7 +1126,7 @@ FX_BOOL CXFA_Bind::SetPicture(const CFX_WideString& wsPicture) { } CXFA_Assist::CXFA_Assist(CXFA_Node* pNode) : CXFA_Data(pNode) {} CXFA_ToolTip CXFA_Assist::GetToolTip() { - return m_pNode->GetChild(0, XFA_ELEMENT_ToolTip); + return CXFA_ToolTip(m_pNode->GetChild(0, XFA_ELEMENT_ToolTip)); } CXFA_ToolTip::CXFA_ToolTip(CXFA_Node* pNode) : CXFA_Data(pNode) {} FX_BOOL CXFA_ToolTip::GetTip(CFX_WideString& wsTip) { @@ -1186,11 +1185,9 @@ int32_t CXFA_Box::CountCorners() const { return m_pNode->CountChildren(XFA_ELEMENT_Corner); } CXFA_Corner CXFA_Box::GetCorner(int32_t nIndex) const { - if (!m_pNode) { - return NULL; - } return CXFA_Corner( - m_pNode->GetProperty(nIndex, XFA_ELEMENT_Corner, nIndex == 0)); + m_pNode ? m_pNode->GetProperty(nIndex, XFA_ELEMENT_Corner, nIndex == 0) + : nullptr); } int32_t CXFA_Box::CountEdges() const { if (!m_pNode) { @@ -1199,10 +1196,9 @@ int32_t CXFA_Box::CountEdges() const { return m_pNode->CountChildren(XFA_ELEMENT_Edge); } CXFA_Edge CXFA_Box::GetEdge(int32_t nIndex) const { - if (!m_pNode) { - return NULL; - } - return CXFA_Edge(m_pNode->GetProperty(nIndex, XFA_ELEMENT_Edge, nIndex == 0)); + return CXFA_Edge( + m_pNode ? m_pNode->GetProperty(nIndex, XFA_ELEMENT_Edge, nIndex == 0) + : nullptr); } static void XFA_BOX_GetStrokes(CXFA_Node* pNode, CXFA_StrokeArray& strokes, @@ -1216,10 +1212,10 @@ static void XFA_BOX_GetStrokes(CXFA_Node* pNode, for (i = 0, j = 0; i < 4; i++) { CXFA_Corner corner = CXFA_Corner(pNode->GetProperty(i, XFA_ELEMENT_Corner, i == 0)); - if (corner.IsExistInXML() || i == 0) { + if (corner || i == 0) { strokes.SetAt(j, corner); } else if (bNULL) { - strokes.SetAt(j, NULL); + strokes.SetAt(j, CXFA_Stroke(nullptr)); } else if (i == 1) { strokes.SetAt(j, strokes[0]); } else if (i == 2) { @@ -1229,10 +1225,10 @@ static void XFA_BOX_GetStrokes(CXFA_Node* pNode, } j++; CXFA_Edge edge = CXFA_Edge(pNode->GetProperty(i, XFA_ELEMENT_Edge, i == 0)); - if (edge.IsExistInXML() || i == 0) { + if (edge || i == 0) { strokes.SetAt(j, edge); } else if (bNULL) { - strokes.SetAt(j, NULL); + strokes.SetAt(j, CXFA_Stroke(nullptr)); } else if (i == 1) { strokes.SetAt(j, strokes[1]); } else if (i == 2) { @@ -1278,16 +1274,14 @@ FX_BOOL CXFA_Box::GetSweepAngle(FX_FLOAT& fSweepAngle) const { } CXFA_Fill CXFA_Box::GetFill(FX_BOOL bModified) const { if (!m_pNode) { - return NULL; + return CXFA_Fill(nullptr); } CXFA_Node* pFillNode = m_pNode->GetProperty(0, XFA_ELEMENT_Fill, bModified); return CXFA_Fill(pFillNode); } CXFA_Margin CXFA_Box::GetMargin() const { - if (!m_pNode) { - return NULL; - } - return CXFA_Margin(m_pNode->GetChild(0, XFA_ELEMENT_Margin)); + return CXFA_Margin(m_pNode ? m_pNode->GetChild(0, XFA_ELEMENT_Margin) + : nullptr); } static FX_BOOL XFA_BOX_SameStyles(const CXFA_StrokeArray& strokes) { int32_t iCount = strokes.GetSize(); @@ -1297,10 +1291,10 @@ static FX_BOOL XFA_BOX_SameStyles(const CXFA_StrokeArray& strokes) { CXFA_Stroke stroke1 = strokes[0]; for (int32_t i = 1; i < iCount; i++) { CXFA_Stroke stroke2 = strokes[i]; - if (!stroke2.IsExistInXML()) { + if (!stroke2) { continue; } - if (!stroke1.IsExistInXML()) { + if (!stroke1) { stroke1 = stroke2; } else if (!stroke1.SameStyles(stroke2)) { return FALSE; @@ -1325,10 +1319,10 @@ static int32_t XFA_BOX_3DStyle(const CXFA_StrokeArray& strokes, stroke = strokes[0]; for (int32_t i = 1; i < iCount; i++) { CXFA_Stroke find = strokes[i]; - if (!find.IsExistInXML()) { + if (!find) { continue; } - if (!stroke.IsExistInXML()) { + if (!stroke) { stroke = find; } else if (stroke.GetStrokeType() != find.GetStrokeType()) { stroke = find; @@ -1428,7 +1422,7 @@ FX_FLOAT CXFA_Stroke::GetRadius() const { : 0; } FX_BOOL CXFA_Stroke::SameStyles(CXFA_Stroke stroke, FX_DWORD dwFlags) const { - if (m_pNode == (CXFA_Node*)stroke) { + if (m_pNode == stroke.GetNode()) { return TRUE; } if (FXSYS_fabs(GetThickness() - stroke.GetThickness()) >= 0.01f) { @@ -1584,26 +1578,30 @@ int32_t CXFA_WidgetData::GetEventByActivity(int32_t iActivity, } CXFA_Value CXFA_WidgetData::GetDefaultValue(FX_BOOL bModified) { CXFA_Node* pTemNode = m_pNode->GetTemplateNode(); - return pTemNode ? pTemNode->GetProperty(0, XFA_ELEMENT_Value, bModified) - : NULL; + return CXFA_Value(pTemNode + ? pTemNode->GetProperty(0, XFA_ELEMENT_Value, bModified) + : nullptr); } CXFA_Value CXFA_WidgetData::GetFormValue(FX_BOOL bModified) { - return m_pNode->GetProperty(0, XFA_ELEMENT_Value, bModified); + return CXFA_Value(m_pNode->GetProperty(0, XFA_ELEMENT_Value, bModified)); } CXFA_Calculate CXFA_WidgetData::GetCalculate(FX_BOOL bModified) { - return m_pNode->GetProperty(0, XFA_ELEMENT_Calculate, bModified); + return CXFA_Calculate( + m_pNode->GetProperty(0, XFA_ELEMENT_Calculate, bModified)); } CXFA_Validate CXFA_WidgetData::GetValidate(FX_BOOL bModified) { - return m_pNode->GetProperty(0, XFA_ELEMENT_Validate, bModified); + return CXFA_Validate( + m_pNode->GetProperty(0, XFA_ELEMENT_Validate, bModified)); } CXFA_Variables CXFA_WidgetData::GetVariables(FX_BOOL bModified) { - return m_pNode->GetProperty(0, XFA_ELEMENT_Variables, bModified); + return CXFA_Variables( + m_pNode->GetProperty(0, XFA_ELEMENT_Variables, bModified)); } CXFA_Bind CXFA_WidgetData::GetBind(FX_BOOL bModified) { - return m_pNode->GetProperty(0, XFA_ELEMENT_Bind, bModified); + return CXFA_Bind(m_pNode->GetProperty(0, XFA_ELEMENT_Bind, bModified)); } CXFA_Assist CXFA_WidgetData::GetAssist(FX_BOOL bModified) { - return m_pNode->GetProperty(0, XFA_ELEMENT_Assist, bModified); + return CXFA_Assist(m_pNode->GetProperty(0, XFA_ELEMENT_Assist, bModified)); } void CXFA_WidgetData::GetRelevant(CFX_WideStringC& wsRelevant) { m_pNode->TryCData(XFA_ATTRIBUTE_Relevant, wsRelevant); @@ -1627,7 +1625,7 @@ FX_BOOL CXFA_WidgetData::GetMaxHeight(FX_FLOAT& fMaxHeight) { return TryMeasure(XFA_ATTRIBUTE_MaxH, fMaxHeight); } CXFA_BindItems CXFA_WidgetData::GetBindItems() { - return m_pNode->GetChild(0, XFA_ELEMENT_BindItems); + return CXFA_BindItems(m_pNode->GetChild(0, XFA_ELEMENT_BindItems)); } FX_BOOL CXFA_WidgetData::SetAccess(int32_t iAccess, FX_BOOL bNotify) { return m_pNode->SetEnum(XFA_ATTRIBUTE_Access, (XFA_ATTRIBUTEENUM)iAccess, @@ -1714,13 +1712,15 @@ FX_BOOL CXFA_WidgetData::SetCheckButtonSize(FX_FLOAT fCheckButtonMark) { } CXFA_Border CXFA_WidgetData::GetUIBorder(FX_BOOL bModified) { CXFA_Node* pUIChild = GetUIChild(); - return pUIChild ? pUIChild->GetProperty(0, XFA_ELEMENT_Border, bModified) - : NULL; + return CXFA_Border( + pUIChild ? pUIChild->GetProperty(0, XFA_ELEMENT_Border, bModified) + : nullptr); } CXFA_Margin CXFA_WidgetData::GetUIMargin(FX_BOOL bModified) { CXFA_Node* pUIChild = GetUIChild(); - return pUIChild ? pUIChild->GetProperty(0, XFA_ELEMENT_Margin, bModified) - : NULL; + return CXFA_Margin( + pUIChild ? pUIChild->GetProperty(0, XFA_ELEMENT_Margin, bModified) + : nullptr); } void CXFA_WidgetData::GetUIMargin(CFX_RectF& rtUIMargin) { rtUIMargin.Reset(); @@ -1862,7 +1862,8 @@ XFA_CHECKSTATE CXFA_WidgetData::GetCheckState() { } void CXFA_WidgetData::SetCheckState(XFA_CHECKSTATE eCheckState, FX_BOOL bNotify) { - if (CXFA_WidgetData exclGroup = GetExclGroupNode()) { + CXFA_WidgetData exclGroup(GetExclGroupNode()); + if (exclGroup) { CFX_WideString wsValue; if (eCheckState != XFA_CHECKSTATE_Off) { if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_ELEMENT_Items)) { @@ -1873,7 +1874,7 @@ void CXFA_WidgetData::SetCheckState(XFA_CHECKSTATE eCheckState, } } CXFA_Node* pChild = - ((CXFA_Node*)exclGroup)->GetNodeItem(XFA_NODEITEM_FirstChild); + exclGroup.GetNode()->GetNodeItem(XFA_NODEITEM_FirstChild); for (; pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { if (pChild->GetClassID() != XFA_ELEMENT_Field) { continue; @@ -3365,15 +3366,17 @@ void CXFA_WidgetData::InsertListTextItem(CXFA_Node* pItems, } CXFA_Filter CXFA_WidgetData::GetFilter(FX_BOOL bModified) { if (!m_pUiChildNode) { - return CXFA_Filter(NULL); + return CXFA_Filter(nullptr); } - return m_pUiChildNode->GetProperty(0, XFA_ELEMENT_Filter, bModified); + return CXFA_Filter( + m_pUiChildNode->GetProperty(0, XFA_ELEMENT_Filter, bModified)); } CXFA_Manifest CXFA_WidgetData::GetManifest(FX_BOOL bModified) { if (!m_pUiChildNode) { - return CXFA_Manifest(NULL); + return CXFA_Manifest(nullptr); } - return m_pUiChildNode->GetProperty(0, XFA_ELEMENT_Manifest, bModified); + return CXFA_Manifest( + m_pUiChildNode->GetProperty(0, XFA_ELEMENT_Manifest, bModified)); } CXFA_Occur::CXFA_Occur(CXFA_Node* pNode) : CXFA_Data(pNode) {} int32_t CXFA_Occur::GetMax() { diff --git a/xfa/src/fxfa/src/parser/xfa_utils_imp.cpp b/xfa/src/fxfa/src/parser/xfa_utils_imp.cpp index 7399422f6c..2f20d2c22a 100644 --- a/xfa/src/fxfa/src/parser/xfa_utils_imp.cpp +++ b/xfa/src/fxfa/src/parser/xfa_utils_imp.cpp @@ -22,7 +22,7 @@ CXFA_Node* XFA_CreateUIChild(CXFA_Node* pNode, XFA_ELEMENT& eWidgetType) { } eWidgetType = XFA_ELEMENT_UNKNOWN; XFA_ELEMENT eUIType = XFA_ELEMENT_UNKNOWN; - CXFA_Value defValue = pNode->GetProperty(0, XFA_ELEMENT_Value, TRUE); + CXFA_Value defValue(pNode->GetProperty(0, XFA_ELEMENT_Value, TRUE)); XFA_ELEMENT eValueType = (XFA_ELEMENT)defValue.GetChildValueClassID(); switch (eValueType) { case XFA_ELEMENT_Boolean: @@ -99,7 +99,7 @@ CXFA_Node* XFA_CreateUIChild(CXFA_Node* pNode, XFA_ELEMENT& eWidgetType) { if (!pUIChild) { if (eUIType == XFA_ELEMENT_UNKNOWN) { eUIType = XFA_ELEMENT_TextEdit; - ((CXFA_Node*)defValue)->GetProperty(0, XFA_ELEMENT_Text, TRUE); + defValue.GetNode()->GetProperty(0, XFA_ELEMENT_Text, TRUE); } pUIChild = pUI->GetProperty(0, eUIType, TRUE); } else if (eUIType == XFA_ELEMENT_UNKNOWN) { @@ -136,7 +136,7 @@ CXFA_Node* XFA_CreateUIChild(CXFA_Node* pNode, XFA_ELEMENT& eWidgetType) { eValueType = XFA_ELEMENT_Text; break; } - ((CXFA_Node*)defValue)->GetProperty(0, eValueType, TRUE); + defValue.GetNode()->GetProperty(0, eValueType, TRUE); } return pUIChild; } |