From 0a9b0a15133370657a2f3e13f062028c17a3dc0b Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 7 Nov 2017 18:44:51 +0000 Subject: Rename CXFA_Caption to CXFA_CaptionData This CL renames CXFA_Caption to CXFA_CaptionData to make it clear it's part of the data hierarchy. Change-Id: I0268005e12a6b58aed7274bf9d023887119a8a63 Reviewed-on: https://pdfium-review.googlesource.com/17977 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- BUILD.gn | 4 ++-- xfa/fxfa/cxfa_ffcheckbutton.cpp | 10 ++++---- xfa/fxfa/cxfa_fffield.cpp | 28 +++++++++++----------- xfa/fxfa/cxfa_fffield.h | 4 ++-- xfa/fxfa/cxfa_ffpushbutton.cpp | 12 +++++----- xfa/fxfa/cxfa_widgetacc.cpp | 33 +++++++++++++------------- xfa/fxfa/parser/cxfa_caption.cpp | 45 ------------------------------------ xfa/fxfa/parser/cxfa_caption.h | 29 ----------------------- xfa/fxfa/parser/cxfa_captiondata.cpp | 45 ++++++++++++++++++++++++++++++++++++ xfa/fxfa/parser/cxfa_captiondata.h | 29 +++++++++++++++++++++++ xfa/fxfa/parser/cxfa_widgetdata.cpp | 4 ++-- xfa/fxfa/parser/cxfa_widgetdata.h | 4 ++-- 12 files changed, 124 insertions(+), 123 deletions(-) delete mode 100644 xfa/fxfa/parser/cxfa_caption.cpp delete mode 100644 xfa/fxfa/parser/cxfa_caption.h create mode 100644 xfa/fxfa/parser/cxfa_captiondata.cpp create mode 100644 xfa/fxfa/parser/cxfa_captiondata.h diff --git a/BUILD.gn b/BUILD.gn index 9fde65ab32..8547b4afd9 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1801,8 +1801,8 @@ if (pdf_enable_xfa) { "xfa/fxfa/parser/cxfa_boxdata.h", "xfa/fxfa/parser/cxfa_calculatedata.cpp", "xfa/fxfa/parser/cxfa_calculatedata.h", - "xfa/fxfa/parser/cxfa_caption.cpp", - "xfa/fxfa/parser/cxfa_caption.h", + "xfa/fxfa/parser/cxfa_captiondata.cpp", + "xfa/fxfa/parser/cxfa_captiondata.h", "xfa/fxfa/parser/cxfa_containerlayoutitem.cpp", "xfa/fxfa/parser/cxfa_containerlayoutitem.h", "xfa/fxfa/parser/cxfa_contentlayoutitem.cpp", diff --git a/xfa/fxfa/cxfa_ffcheckbutton.cpp b/xfa/fxfa/cxfa_ffcheckbutton.cpp index ab303b08dd..87fa41f3b7 100644 --- a/xfa/fxfa/cxfa_ffcheckbutton.cpp +++ b/xfa/fxfa/cxfa_ffcheckbutton.cpp @@ -98,11 +98,11 @@ bool CXFA_FFCheckButton::PerformLayout() { int32_t iCapPlacement = -1; float fCapReserve = 0; - CXFA_Caption caption = m_pDataAcc->GetCaption(); - if (caption && caption.GetPresence()) { + CXFA_CaptionData captionData = m_pDataAcc->GetCaptionData(); + if (captionData && captionData.GetPresence()) { m_rtCaption = rtWidget; - iCapPlacement = caption.GetPlacementType(); - fCapReserve = caption.GetReserve(); + iCapPlacement = captionData.GetPlacementType(); + fCapReserve = captionData.GetReserve(); if (fCapReserve <= 0) { if (iCapPlacement == XFA_ATTRIBUTEENUM_Top || iCapPlacement == XFA_ATTRIBUTEENUM_Bottom) { @@ -121,7 +121,7 @@ bool CXFA_FFCheckButton::PerformLayout() { } m_rtUI = rtWidget; - CXFA_Margin mgCap = caption.GetMargin(); + CXFA_Margin mgCap = captionData.GetMargin(); switch (iCapPlacement) { case XFA_ATTRIBUTEENUM_Left: { m_rtCaption.width = fCapReserve; diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp index b1c8c32684..b1f4f20861 100644 --- a/xfa/fxfa/cxfa_fffield.cpp +++ b/xfa/fxfa/cxfa_fffield.cpp @@ -191,15 +191,15 @@ void CXFA_FFField::CapPlacement() { XFA_ATTRIBUTEENUM iCapPlacement = XFA_ATTRIBUTEENUM_Unknown; float fCapReserve = 0; - CXFA_Caption caption = m_pDataAcc->GetCaption(); - if (caption && caption.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) { - iCapPlacement = (XFA_ATTRIBUTEENUM)caption.GetPlacementType(); + CXFA_CaptionData captionData = m_pDataAcc->GetCaptionData(); + if (captionData && captionData.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) { + iCapPlacement = (XFA_ATTRIBUTEENUM)captionData.GetPlacementType(); if (iCapPlacement == XFA_ATTRIBUTEENUM_Top && GetPrev()) { m_rtCaption.Reset(); } else if (iCapPlacement == XFA_ATTRIBUTEENUM_Bottom && GetNext()) { m_rtCaption.Reset(); } else { - fCapReserve = caption.GetReserve(); + fCapReserve = captionData.GetReserve(); CXFA_LayoutItem* pItem = this; if (!pItem->GetPrev() && !pItem->GetNext()) { m_rtCaption = rtWidget; @@ -234,14 +234,14 @@ void CXFA_FFField::CapPlacement() { switch (iCapPlacement) { case XFA_ATTRIBUTEENUM_Left: { m_rtCaption.width = fCapReserve; - CapLeftRightPlacement(caption, rtWidget, iCapPlacement); + CapLeftRightPlacement(captionData, rtWidget, iCapPlacement); m_rtUI.width -= fCapReserve; m_rtUI.left += fCapReserve; break; } case XFA_ATTRIBUTEENUM_Top: { m_rtCaption.height = fCapReserve; - CapTopBottomPlacement(caption, rtWidget, iCapPlacement); + CapTopBottomPlacement(captionData, rtWidget, iCapPlacement); m_rtUI.top += fCapReserve; m_rtUI.height -= fCapReserve; break; @@ -249,14 +249,14 @@ void CXFA_FFField::CapPlacement() { case XFA_ATTRIBUTEENUM_Right: { m_rtCaption.left = m_rtCaption.right() - fCapReserve; m_rtCaption.width = fCapReserve; - CapLeftRightPlacement(caption, rtWidget, iCapPlacement); + CapLeftRightPlacement(captionData, rtWidget, iCapPlacement); m_rtUI.width -= fCapReserve; break; } case XFA_ATTRIBUTEENUM_Bottom: { m_rtCaption.top = m_rtCaption.bottom() - fCapReserve; m_rtCaption.height = fCapReserve; - CapTopBottomPlacement(caption, rtWidget, iCapPlacement); + CapTopBottomPlacement(captionData, rtWidget, iCapPlacement); m_rtUI.height -= fCapReserve; break; } @@ -275,12 +275,12 @@ void CXFA_FFField::CapPlacement() { m_rtUI.Normalize(); } -void CXFA_FFField::CapTopBottomPlacement(CXFA_Caption caption, +void CXFA_FFField::CapTopBottomPlacement(CXFA_CaptionData captionData, const CFX_RectF& rtWidget, int32_t iCapPlacement) { CFX_RectF rtUIMargin = m_pDataAcc->GetUIMargin(); m_rtCaption.left += rtUIMargin.left; - if (CXFA_Margin mgCap = caption.GetMargin()) { + if (CXFA_Margin mgCap = captionData.GetMargin()) { XFA_RectWidthoutMargin(m_rtCaption, mgCap); if (m_rtCaption.height < 0) m_rtCaption.top += m_rtCaption.height; @@ -301,13 +301,13 @@ void CXFA_FFField::CapTopBottomPlacement(CXFA_Caption caption, } } -void CXFA_FFField::CapLeftRightPlacement(CXFA_Caption caption, +void CXFA_FFField::CapLeftRightPlacement(CXFA_CaptionData captionData, const CFX_RectF& rtWidget, int32_t iCapPlacement) { CFX_RectF rtUIMargin = m_pDataAcc->GetUIMargin(); m_rtCaption.top += rtUIMargin.top; m_rtCaption.height -= rtUIMargin.top; - if (CXFA_Margin mgCap = caption.GetMargin()) { + if (CXFA_Margin mgCap = captionData.GetMargin()) { XFA_RectWidthoutMargin(m_rtCaption, mgCap); if (m_rtCaption.height < 0) m_rtCaption.top += m_rtCaption.height; @@ -604,8 +604,8 @@ void CXFA_FFField::RenderCaption(CXFA_Graphics* pGS, CFX_Matrix* pMatrix) { if (!pCapTextLayout) return; - CXFA_Caption caption = m_pDataAcc->GetCaption(); - if (!caption || caption.GetPresence() != XFA_ATTRIBUTEENUM_Visible) + CXFA_CaptionData captionData = m_pDataAcc->GetCaptionData(); + if (!captionData || captionData.GetPresence() != XFA_ATTRIBUTEENUM_Visible) return; if (!pCapTextLayout->IsLoaded()) diff --git a/xfa/fxfa/cxfa_fffield.h b/xfa/fxfa/cxfa_fffield.h index e47664291a..7d4320717f 100644 --- a/xfa/fxfa/cxfa_fffield.h +++ b/xfa/fxfa/cxfa_fffield.h @@ -83,10 +83,10 @@ class CXFA_FFField : public CXFA_FFWidget, public IFWL_WidgetDelegate { void DrawFocus(CXFA_Graphics* pGS, CFX_Matrix* pMatrix); void TranslateFWLMessage(CFWL_Message* pMessage); void CapPlacement(); - void CapTopBottomPlacement(CXFA_Caption caption, + void CapTopBottomPlacement(CXFA_CaptionData captionData, const CFX_RectF& rtWidget, int32_t iCapPlacement); - void CapLeftRightPlacement(CXFA_Caption caption, + void CapLeftRightPlacement(CXFA_CaptionData captionData, const CFX_RectF& rtWidget, int32_t iCapPlacement); void SetEditScrollOffset(); diff --git a/xfa/fxfa/cxfa_ffpushbutton.cpp b/xfa/fxfa/cxfa_ffpushbutton.cpp index 7c532fc01f..9ec48b865d 100644 --- a/xfa/fxfa/cxfa_ffpushbutton.cpp +++ b/xfa/fxfa/cxfa_ffpushbutton.cpp @@ -100,9 +100,9 @@ bool CXFA_FFPushButton::PerformLayout() { if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) XFA_RectWidthoutMargin(rtWidget, mgWidget); - CXFA_Caption caption = m_pDataAcc->GetCaption(); + CXFA_CaptionData captionData = m_pDataAcc->GetCaptionData(); m_rtCaption = rtWidget; - if (CXFA_Margin mgCap = caption.GetMargin()) + if (CXFA_Margin mgCap = captionData.GetMargin()) XFA_RectWidthoutMargin(m_rtCaption, mgCap); LayoutHighlightCaption(); @@ -130,8 +130,8 @@ FX_ARGB CXFA_FFPushButton::GetFillColor() { } void CXFA_FFPushButton::LoadHighlightCaption() { - CXFA_Caption caption = m_pDataAcc->GetCaption(); - if (!caption || caption.GetPresence() == XFA_ATTRIBUTEENUM_Hidden) + CXFA_CaptionData captionData = m_pDataAcc->GetCaptionData(); + if (!captionData || captionData.GetPresence() == XFA_ATTRIBUTEENUM_Hidden) return; bool bRichText; @@ -167,8 +167,8 @@ void CXFA_FFPushButton::LayoutHighlightCaption() { void CXFA_FFPushButton::RenderHighlightCaption(CXFA_Graphics* pGS, CFX_Matrix* pMatrix) { CXFA_TextLayout* pCapTextLayout = m_pDataAcc->GetCaptionTextLayout(); - CXFA_Caption caption = m_pDataAcc->GetCaption(); - if (!caption || caption.GetPresence() != XFA_ATTRIBUTEENUM_Visible) + CXFA_CaptionData captionData = m_pDataAcc->GetCaptionData(); + if (!captionData || captionData.GetPresence() != XFA_ATTRIBUTEENUM_Visible) return; CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice(); diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp index 59046d3313..9be0bdb203 100644 --- a/xfa/fxfa/cxfa_widgetacc.cpp +++ b/xfa/fxfa/cxfa_widgetacc.cpp @@ -105,9 +105,10 @@ class CXFA_FieldLayoutData : public CXFA_WidgetLayoutData { bool LoadCaption(CXFA_WidgetAcc* pAcc) { if (m_pCapTextLayout) return true; - CXFA_Caption caption = pAcc->GetCaption(); - if (!caption || caption.GetPresence() == XFA_ATTRIBUTEENUM_Hidden) + CXFA_CaptionData captionData = pAcc->GetCaptionData(); + if (!captionData || captionData.GetPresence() == XFA_ATTRIBUTEENUM_Hidden) return false; + m_pCapTextProvider = pdfium::MakeUnique( pAcc, XFA_TEXTPROVIDERTYPE_Caption); m_pCapTextLayout = @@ -501,8 +502,8 @@ WideString CXFA_WidgetAcc::GetValidateCaptionName(bool bVersionFlag) { WideString wsCaptionName; if (!bVersionFlag) { - if (CXFA_Caption caption = GetCaption()) { - if (CXFA_Value capValue = caption.GetValue()) { + if (CXFA_CaptionData captionData = GetCaptionData()) { + if (CXFA_Value capValue = captionData.GetValue()) { if (CXFA_Text capText = capValue.GetText()) capText.GetContent(wsCaptionName); } @@ -687,14 +688,14 @@ void CXFA_WidgetAcc::UpdateUIDisplay(CXFA_FFWidget* pExcept) { } void CXFA_WidgetAcc::CalcCaptionSize(CFX_SizeF& szCap) { - CXFA_Caption caption = GetCaption(); - if (!caption || caption.GetPresence() != XFA_ATTRIBUTEENUM_Visible) + CXFA_CaptionData captionData = GetCaptionData(); + if (!captionData || captionData.GetPresence() != XFA_ATTRIBUTEENUM_Visible) return; LoadCaption(); XFA_Element eUIType = GetUIType(); - int32_t iCapPlacement = caption.GetPlacementType(); - float fCapReserve = caption.GetReserve(); + int32_t iCapPlacement = captionData.GetPlacementType(); + float fCapReserve = captionData.GetReserve(); const bool bVert = iCapPlacement == XFA_ATTRIBUTEENUM_Top || iCapPlacement == XFA_ATTRIBUTEENUM_Bottom; const bool bReserveExit = fCapReserve > 0.01; @@ -711,7 +712,7 @@ void CXFA_WidgetAcc::CalcCaptionSize(CFX_SizeF& szCap) { bVert ? szCap.height = fCapReserve : szCap.width = fCapReserve; } else { float fFontSize = 10.0f; - if (CXFA_Font font = caption.GetFont()) + if (CXFA_Font font = captionData.GetFont()) fFontSize = font.GetFontSize(); else if (CXFA_Font widgetfont = GetFont(false)) fFontSize = widgetfont.GetFontSize(); @@ -723,7 +724,7 @@ void CXFA_WidgetAcc::CalcCaptionSize(CFX_SizeF& szCap) { szCap.height = fFontSize; } } - if (CXFA_Margin mgCap = caption.GetMargin()) { + if (CXFA_Margin mgCap = captionData.GetMargin()) { float fLeftInset, fTopInset, fRightInset, fBottomInset; mgCap.GetLeftInset(fLeftInset); mgCap.GetTopInset(fTopInset); @@ -746,7 +747,7 @@ bool CXFA_WidgetAcc::CalculateFieldAutoSize(CFX_SizeF& size) { size.width += rtUIMargin.left + rtUIMargin.width; size.height += rtUIMargin.top + rtUIMargin.height; if (szCap.width > 0 && szCap.height > 0) { - int32_t iCapPlacement = GetCaption().GetPlacementType(); + int32_t iCapPlacement = GetCaptionData().GetPlacementType(); switch (iCapPlacement) { case XFA_ATTRIBUTEENUM_Left: case XFA_ATTRIBUTEENUM_Right: @@ -848,7 +849,7 @@ bool CXFA_WidgetAcc::CalculateTextEditAutoSize(CFX_SizeF& size) { bool bCapExit = szCap.width > 0.01 && szCap.height > 0.01; int32_t iCapPlacement = XFA_ATTRIBUTEENUM_Unknown; if (bCapExit) { - iCapPlacement = GetCaption().GetPlacementType(); + iCapPlacement = GetCaptionData().GetPlacementType(); switch (iCapPlacement) { case XFA_ATTRIBUTEENUM_Left: case XFA_ATTRIBUTEENUM_Right: @@ -1184,10 +1185,10 @@ bool CXFA_WidgetAcc::FindSplitPos(int32_t iBlockIndex, float& fCalcHeight) { XFA_ATTRIBUTEENUM iCapPlacement = XFA_ATTRIBUTEENUM_Unknown; float fCapReserve = 0; if (iBlockIndex == 0) { - CXFA_Caption caption = GetCaption(); - if (caption && caption.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) { - iCapPlacement = (XFA_ATTRIBUTEENUM)caption.GetPlacementType(); - fCapReserve = caption.GetReserve(); + CXFA_CaptionData captionData = GetCaptionData(); + if (captionData && captionData.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) { + iCapPlacement = (XFA_ATTRIBUTEENUM)captionData.GetPlacementType(); + fCapReserve = captionData.GetReserve(); } if (iCapPlacement == XFA_ATTRIBUTEENUM_Top && fCalcHeight < fCapReserve + fTopInset) { diff --git a/xfa/fxfa/parser/cxfa_caption.cpp b/xfa/fxfa/parser/cxfa_caption.cpp deleted file mode 100644 index 3f820e437e..0000000000 --- a/xfa/fxfa/parser/cxfa_caption.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "xfa/fxfa/parser/cxfa_caption.h" - -#include "xfa/fxfa/parser/cxfa_measurement.h" -#include "xfa/fxfa/parser/cxfa_node.h" - -CXFA_Caption::CXFA_Caption(CXFA_Node* pNode) : CXFA_Data(pNode) {} - -int32_t CXFA_Caption::GetPresence() { - XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_Visible; - m_pNode->JSNode()->TryEnum(XFA_ATTRIBUTE_Presence, eAttr, true); - return eAttr; -} - -int32_t CXFA_Caption::GetPlacementType() { - XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_Left; - m_pNode->JSNode()->TryEnum(XFA_ATTRIBUTE_Placement, eAttr, true); - return eAttr; -} - -float CXFA_Caption::GetReserve() { - CXFA_Measurement ms; - m_pNode->JSNode()->TryMeasure(XFA_ATTRIBUTE_Reserve, ms, true); - return ms.ToUnit(XFA_UNIT_Pt); -} - -CXFA_Margin CXFA_Caption::GetMargin() { - return CXFA_Margin(m_pNode ? m_pNode->GetChild(0, XFA_Element::Margin, false) - : nullptr); -} - -CXFA_Font CXFA_Caption::GetFont() { - return CXFA_Font(m_pNode ? m_pNode->GetChild(0, XFA_Element::Font, false) - : nullptr); -} - -CXFA_Value CXFA_Caption::GetValue() { - return CXFA_Value(m_pNode ? m_pNode->GetChild(0, XFA_Element::Value, false) - : nullptr); -} diff --git a/xfa/fxfa/parser/cxfa_caption.h b/xfa/fxfa/parser/cxfa_caption.h deleted file mode 100644 index 74650ef9a2..0000000000 --- a/xfa/fxfa/parser/cxfa_caption.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FXFA_PARSER_CXFA_CAPTION_H_ -#define XFA_FXFA_PARSER_CXFA_CAPTION_H_ - -#include "xfa/fxfa/parser/cxfa_data.h" -#include "xfa/fxfa/parser/cxfa_font.h" -#include "xfa/fxfa/parser/cxfa_margin.h" -#include "xfa/fxfa/parser/cxfa_value.h" - -class CXFA_Node; - -class CXFA_Caption : public CXFA_Data { - public: - explicit CXFA_Caption(CXFA_Node* pNode); - - int32_t GetPresence(); - int32_t GetPlacementType(); - float GetReserve(); - CXFA_Margin GetMargin(); - CXFA_Font GetFont(); - CXFA_Value GetValue(); -}; - -#endif // XFA_FXFA_PARSER_CXFA_CAPTION_H_ diff --git a/xfa/fxfa/parser/cxfa_captiondata.cpp b/xfa/fxfa/parser/cxfa_captiondata.cpp new file mode 100644 index 0000000000..db18f9a159 --- /dev/null +++ b/xfa/fxfa/parser/cxfa_captiondata.cpp @@ -0,0 +1,45 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#include "xfa/fxfa/parser/cxfa_captiondata.h" + +#include "xfa/fxfa/parser/cxfa_measurement.h" +#include "xfa/fxfa/parser/cxfa_node.h" + +CXFA_CaptionData::CXFA_CaptionData(CXFA_Node* pNode) : CXFA_Data(pNode) {} + +int32_t CXFA_CaptionData::GetPresence() { + XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_Visible; + m_pNode->JSNode()->TryEnum(XFA_ATTRIBUTE_Presence, eAttr, true); + return eAttr; +} + +int32_t CXFA_CaptionData::GetPlacementType() { + XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_Left; + m_pNode->JSNode()->TryEnum(XFA_ATTRIBUTE_Placement, eAttr, true); + return eAttr; +} + +float CXFA_CaptionData::GetReserve() { + CXFA_Measurement ms; + m_pNode->JSNode()->TryMeasure(XFA_ATTRIBUTE_Reserve, ms, true); + return ms.ToUnit(XFA_UNIT_Pt); +} + +CXFA_Margin CXFA_CaptionData::GetMargin() { + return CXFA_Margin(m_pNode ? m_pNode->GetChild(0, XFA_Element::Margin, false) + : nullptr); +} + +CXFA_Font CXFA_CaptionData::GetFont() { + return CXFA_Font(m_pNode ? m_pNode->GetChild(0, XFA_Element::Font, false) + : nullptr); +} + +CXFA_Value CXFA_CaptionData::GetValue() { + return CXFA_Value(m_pNode ? m_pNode->GetChild(0, XFA_Element::Value, false) + : nullptr); +} diff --git a/xfa/fxfa/parser/cxfa_captiondata.h b/xfa/fxfa/parser/cxfa_captiondata.h new file mode 100644 index 0000000000..605a837a1b --- /dev/null +++ b/xfa/fxfa/parser/cxfa_captiondata.h @@ -0,0 +1,29 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef XFA_FXFA_PARSER_CXFA_CAPTIONDATA_H_ +#define XFA_FXFA_PARSER_CXFA_CAPTIONDATA_H_ + +#include "xfa/fxfa/parser/cxfa_data.h" +#include "xfa/fxfa/parser/cxfa_font.h" +#include "xfa/fxfa/parser/cxfa_margin.h" +#include "xfa/fxfa/parser/cxfa_value.h" + +class CXFA_Node; + +class CXFA_CaptionData : public CXFA_Data { + public: + explicit CXFA_CaptionData(CXFA_Node* pNode); + + int32_t GetPresence(); + int32_t GetPlacementType(); + float GetReserve(); + CXFA_Margin GetMargin(); + CXFA_Font GetFont(); + CXFA_Value GetValue(); +}; + +#endif // XFA_FXFA_PARSER_CXFA_CAPTIONDATA_H_ diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index d8d5cfcc1d..ccce8cf501 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -284,8 +284,8 @@ CXFA_BorderData CXFA_WidgetData::GetBorderData(bool bModified) { m_pNode->JSNode()->GetProperty(0, XFA_Element::Border, bModified)); } -CXFA_Caption CXFA_WidgetData::GetCaption() { - return CXFA_Caption( +CXFA_CaptionData CXFA_WidgetData::GetCaptionData() { + return CXFA_CaptionData( m_pNode->JSNode()->GetProperty(0, XFA_Element::Caption, false)); } diff --git a/xfa/fxfa/parser/cxfa_widgetdata.h b/xfa/fxfa/parser/cxfa_widgetdata.h index 4689878e9f..92fc4484b2 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.h +++ b/xfa/fxfa/parser/cxfa_widgetdata.h @@ -16,7 +16,7 @@ #include "xfa/fxfa/parser/cxfa_binddata.h" #include "xfa/fxfa/parser/cxfa_borderdata.h" #include "xfa/fxfa/parser/cxfa_calculatedata.h" -#include "xfa/fxfa/parser/cxfa_caption.h" +#include "xfa/fxfa/parser/cxfa_captiondata.h" #include "xfa/fxfa/parser/cxfa_data.h" #include "xfa/fxfa/parser/cxfa_font.h" #include "xfa/fxfa/parser/cxfa_margin.h" @@ -51,7 +51,7 @@ class CXFA_WidgetData : public CXFA_Data { CXFA_AssistData GetAssistData(); CXFA_BorderData GetBorderData(bool bModified); - CXFA_Caption GetCaption(); + CXFA_CaptionData GetCaptionData(); CXFA_Font GetFont(bool bModified); CXFA_Margin GetMargin(); CXFA_Para GetPara(); -- cgit v1.2.3