diff options
author | Tom Sepez <tsepez@chromium.org> | 2016-02-03 16:38:30 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2016-02-03 16:38:30 -0800 |
commit | 99ddbfbcc3d0e8a52c8f8a4ec22462d9e00c1c6a (patch) | |
tree | 78c6b05d9295e31aa2640aaa280c89e2a5e4fbd0 /xfa/src/fxfa | |
parent | 18d8521c73b65a3e2546372a9e87c87664937b72 (diff) | |
download | pdfium-99ddbfbcc3d0e8a52c8f8a4ec22462d9e00c1c6a.tar.xz |
Make CXFA_Data sub-classes ctors explicit.
Remove implicit CXFA_Node* operator.
Add bool() operator.
Remove IsExistInXML() which duplicates bool operator.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1663313002 .
Diffstat (limited to 'xfa/src/fxfa')
-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 |
13 files changed, 129 insertions, 136 deletions
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; } |