summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BUILD.gn2
-rw-r--r--xfa/fxfa/cxfa_ffcheckbutton.cpp9
-rw-r--r--xfa/fxfa/cxfa_ffcombobox.cpp9
-rw-r--r--xfa/fxfa/cxfa_ffdatetimeedit.cpp9
-rw-r--r--xfa/fxfa/cxfa_ffimage.cpp9
-rw-r--r--xfa/fxfa/cxfa_ffimageedit.cpp9
-rw-r--r--xfa/fxfa/cxfa_fflistbox.cpp7
-rw-r--r--xfa/fxfa/cxfa_fftextedit.cpp9
-rw-r--r--xfa/fxfa/cxfa_fwltheme.cpp17
-rw-r--r--xfa/fxfa/cxfa_textlayout.cpp34
-rw-r--r--xfa/fxfa/cxfa_textparser.cpp32
-rw-r--r--xfa/fxfa/cxfa_textprovider.cpp6
-rw-r--r--xfa/fxfa/cxfa_textprovider.h3
-rw-r--r--xfa/fxfa/cxfa_widgetacc.cpp23
-rw-r--r--xfa/fxfa/parser/cxfa_para.cpp39
-rw-r--r--xfa/fxfa/parser/cxfa_para.h9
-rw-r--r--xfa/fxfa/parser/cxfa_paradata.cpp60
-rw-r--r--xfa/fxfa/parser/cxfa_paradata.h29
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.cpp6
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.h4
20 files changed, 144 insertions, 181 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 7ea6f5e0b5..20c51c61a0 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -2528,8 +2528,6 @@ if (pdf_enable_xfa) {
"xfa/fxfa/parser/cxfa_paginationoverride.h",
"xfa/fxfa/parser/cxfa_para.cpp",
"xfa/fxfa/parser/cxfa_para.h",
- "xfa/fxfa/parser/cxfa_paradata.cpp",
- "xfa/fxfa/parser/cxfa_paradata.h",
"xfa/fxfa/parser/cxfa_part.cpp",
"xfa/fxfa/parser/cxfa_part.h",
"xfa/fxfa/parser/cxfa_password.cpp",
diff --git a/xfa/fxfa/cxfa_ffcheckbutton.cpp b/xfa/fxfa/cxfa_ffcheckbutton.cpp
index c3ac7f6cd7..8dc2882504 100644
--- a/xfa/fxfa/cxfa_ffcheckbutton.cpp
+++ b/xfa/fxfa/cxfa_ffcheckbutton.cpp
@@ -19,6 +19,7 @@
#include "xfa/fxfa/cxfa_fffield.h"
#include "xfa/fxfa/cxfa_ffpageview.h"
#include "xfa/fxfa/cxfa_ffwidget.h"
+#include "xfa/fxfa/parser/cxfa_para.h"
CXFA_FFCheckButton::CXFA_FFCheckButton(CXFA_WidgetAcc* pDataAcc)
: CXFA_FFField(pDataAcc), m_pOldDelegate(nullptr) {}
@@ -112,10 +113,10 @@ bool CXFA_FFCheckButton::PerformLayout() {
XFA_AttributeEnum iHorzAlign = XFA_AttributeEnum::Left;
XFA_AttributeEnum iVertAlign = XFA_AttributeEnum::Top;
- CXFA_ParaData paraData = m_pDataAcc->GetParaData();
- if (paraData.HasValidNode()) {
- iHorzAlign = paraData.GetHorizontalAlign();
- iVertAlign = paraData.GetVerticalAlign();
+ CXFA_Para* para = m_pDataAcc->GetPara();
+ if (para) {
+ iHorzAlign = para->GetHorizontalAlign();
+ iVertAlign = para->GetVerticalAlign();
}
m_rtUI = rtWidget;
diff --git a/xfa/fxfa/cxfa_ffcombobox.cpp b/xfa/fxfa/cxfa_ffcombobox.cpp
index cc5569ea85..706c430717 100644
--- a/xfa/fxfa/cxfa_ffcombobox.cpp
+++ b/xfa/fxfa/cxfa_ffcombobox.cpp
@@ -14,6 +14,7 @@
#include "xfa/fwl/cfwl_notedriver.h"
#include "xfa/fxfa/cxfa_eventparam.h"
#include "xfa/fxfa/cxfa_ffdocview.h"
+#include "xfa/fxfa/parser/cxfa_para.h"
namespace {
@@ -139,12 +140,12 @@ void CXFA_FFComboBox::FWLEventSelChange(CXFA_EventParam* pParam) {
}
uint32_t CXFA_FFComboBox::GetAlignment() {
- CXFA_ParaData paraData = m_pDataAcc->GetParaData();
- if (!paraData.HasValidNode())
+ CXFA_Para* para = m_pDataAcc->GetPara();
+ if (!para)
return 0;
uint32_t dwExtendedStyle = 0;
- switch (paraData.GetHorizontalAlign()) {
+ switch (para->GetHorizontalAlign()) {
case XFA_AttributeEnum::Center:
dwExtendedStyle |=
FWL_STYLEEXT_CMB_EditHCenter | FWL_STYLEEXT_CMB_ListItemCenterAlign;
@@ -164,7 +165,7 @@ uint32_t CXFA_FFComboBox::GetAlignment() {
break;
}
- switch (paraData.GetVerticalAlign()) {
+ switch (para->GetVerticalAlign()) {
case XFA_AttributeEnum::Middle:
dwExtendedStyle |= FWL_STYLEEXT_CMB_EditVCenter;
break;
diff --git a/xfa/fxfa/cxfa_ffdatetimeedit.cpp b/xfa/fxfa/cxfa_ffdatetimeedit.cpp
index ddc1450b51..969d69c56b 100644
--- a/xfa/fxfa/cxfa_ffdatetimeedit.cpp
+++ b/xfa/fxfa/cxfa_ffdatetimeedit.cpp
@@ -15,6 +15,7 @@
#include "xfa/fxfa/cxfa_eventparam.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
#include "xfa/fxfa/parser/cxfa_localevalue.h"
+#include "xfa/fxfa/parser/cxfa_para.h"
#include "xfa/fxfa/parser/cxfa_value.h"
#include "xfa/fxfa/parser/xfa_utils.h"
@@ -99,12 +100,12 @@ void CXFA_FFDateTimeEdit::UpdateWidgetProperty() {
}
uint32_t CXFA_FFDateTimeEdit::GetAlignment() {
- CXFA_ParaData paraData = m_pDataAcc->GetParaData();
- if (!paraData.HasValidNode())
+ CXFA_Para* para = m_pDataAcc->GetPara();
+ if (!para)
return 0;
uint32_t dwExtendedStyle = 0;
- switch (paraData.GetHorizontalAlign()) {
+ switch (para->GetHorizontalAlign()) {
case XFA_AttributeEnum::Center:
dwExtendedStyle |= FWL_STYLEEXT_DTP_EditHCenter;
break;
@@ -122,7 +123,7 @@ uint32_t CXFA_FFDateTimeEdit::GetAlignment() {
break;
}
- switch (paraData.GetVerticalAlign()) {
+ switch (para->GetVerticalAlign()) {
case XFA_AttributeEnum::Middle:
dwExtendedStyle |= FWL_STYLEEXT_DTP_EditVCenter;
break;
diff --git a/xfa/fxfa/cxfa_ffimage.cpp b/xfa/fxfa/cxfa_ffimage.cpp
index 159c6648b5..864d34e101 100644
--- a/xfa/fxfa/cxfa_ffimage.cpp
+++ b/xfa/fxfa/cxfa_ffimage.cpp
@@ -11,6 +11,7 @@
#include "xfa/fxfa/cxfa_ffdraw.h"
#include "xfa/fxfa/cxfa_ffpageview.h"
#include "xfa/fxfa/cxfa_ffwidget.h"
+#include "xfa/fxfa/parser/cxfa_para.h"
#include "xfa/fxfa/parser/cxfa_value.h"
CXFA_FFImage::CXFA_FFImage(CXFA_WidgetAcc* pDataAcc) : CXFA_FFDraw(pDataAcc) {}
@@ -56,10 +57,10 @@ void CXFA_FFImage::RenderWidget(CXFA_Graphics* pGS,
XFA_AttributeEnum iHorzAlign = XFA_AttributeEnum::Left;
XFA_AttributeEnum iVertAlign = XFA_AttributeEnum::Top;
- CXFA_ParaData paraData = m_pDataAcc->GetParaData();
- if (paraData.HasValidNode()) {
- iHorzAlign = paraData.GetHorizontalAlign();
- iVertAlign = paraData.GetVerticalAlign();
+ CXFA_Para* para = m_pDataAcc->GetPara();
+ if (para) {
+ iHorzAlign = para->GetHorizontalAlign();
+ iVertAlign = para->GetVerticalAlign();
}
int32_t iImageXDpi = 0;
diff --git a/xfa/fxfa/cxfa_ffimageedit.cpp b/xfa/fxfa/cxfa_ffimageedit.cpp
index 6d63514a18..3705241baf 100644
--- a/xfa/fxfa/cxfa_ffimageedit.cpp
+++ b/xfa/fxfa/cxfa_ffimageedit.cpp
@@ -18,6 +18,7 @@
#include "xfa/fxfa/cxfa_fffield.h"
#include "xfa/fxfa/cxfa_ffpageview.h"
#include "xfa/fxfa/cxfa_ffwidget.h"
+#include "xfa/fxfa/parser/cxfa_para.h"
#include "xfa/fxfa/parser/cxfa_value.h"
CXFA_FFImageEdit::CXFA_FFImageEdit(CXFA_WidgetAcc* pDataAcc)
@@ -71,10 +72,10 @@ void CXFA_FFImageEdit::RenderWidget(CXFA_Graphics* pGS,
CFX_RectF rtImage = m_pNormalWidget->GetWidgetRect();
XFA_AttributeEnum iHorzAlign = XFA_AttributeEnum::Left;
XFA_AttributeEnum iVertAlign = XFA_AttributeEnum::Top;
- CXFA_ParaData paraData = m_pDataAcc->GetParaData();
- if (paraData.HasValidNode()) {
- iHorzAlign = paraData.GetHorizontalAlign();
- iVertAlign = paraData.GetVerticalAlign();
+ CXFA_Para* para = m_pDataAcc->GetPara();
+ if (para) {
+ iHorzAlign = para->GetHorizontalAlign();
+ iVertAlign = para->GetVerticalAlign();
}
XFA_AttributeEnum iAspect = XFA_AttributeEnum::Fit;
diff --git a/xfa/fxfa/cxfa_fflistbox.cpp b/xfa/fxfa/cxfa_fflistbox.cpp
index ce9d26d917..c8cb403e55 100644
--- a/xfa/fxfa/cxfa_fflistbox.cpp
+++ b/xfa/fxfa/cxfa_fflistbox.cpp
@@ -14,6 +14,7 @@
#include "xfa/fwl/cfwl_notedriver.h"
#include "xfa/fwl/cfwl_widget.h"
#include "xfa/fxfa/cxfa_eventparam.h"
+#include "xfa/fxfa/parser/cxfa_para.h"
namespace {
@@ -104,12 +105,12 @@ bool CXFA_FFListBox::IsDataChanged() {
}
uint32_t CXFA_FFListBox::GetAlignment() {
- CXFA_ParaData paraData = m_pDataAcc->GetParaData();
- if (!paraData.HasValidNode())
+ CXFA_Para* para = m_pDataAcc->GetPara();
+ if (!para)
return 0;
uint32_t dwExtendedStyle = 0;
- switch (paraData.GetHorizontalAlign()) {
+ switch (para->GetHorizontalAlign()) {
case XFA_AttributeEnum::Center:
dwExtendedStyle |= FWL_STYLEEXT_LTB_CenterAlign;
break;
diff --git a/xfa/fxfa/cxfa_fftextedit.cpp b/xfa/fxfa/cxfa_fftextedit.cpp
index ea9e4dbe36..bf25b8bfb3 100644
--- a/xfa/fxfa/cxfa_fftextedit.cpp
+++ b/xfa/fxfa/cxfa_fftextedit.cpp
@@ -20,6 +20,7 @@
#include "xfa/fxfa/cxfa_ffapp.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
#include "xfa/fxfa/parser/cxfa_node.h"
+#include "xfa/fxfa/parser/cxfa_para.h"
namespace {
@@ -214,12 +215,12 @@ bool CXFA_FFTextEdit::IsDataChanged() {
}
uint32_t CXFA_FFTextEdit::GetAlignment() {
- CXFA_ParaData paraData = m_pDataAcc->GetParaData();
- if (!paraData.HasValidNode())
+ CXFA_Para* para = m_pDataAcc->GetPara();
+ if (!para)
return 0;
uint32_t dwExtendedStyle = 0;
- switch (paraData.GetHorizontalAlign()) {
+ switch (para->GetHorizontalAlign()) {
case XFA_AttributeEnum::Center:
dwExtendedStyle |= FWL_STYLEEXT_EDT_HCenter;
break;
@@ -237,7 +238,7 @@ uint32_t CXFA_FFTextEdit::GetAlignment() {
break;
}
- switch (paraData.GetVerticalAlign()) {
+ switch (para->GetVerticalAlign()) {
case XFA_AttributeEnum::Middle:
dwExtendedStyle |= FWL_STYLEEXT_EDT_VCenter;
break;
diff --git a/xfa/fxfa/cxfa_fwltheme.cpp b/xfa/fxfa/cxfa_fwltheme.cpp
index 88aeef68c5..8330ed49d8 100644
--- a/xfa/fxfa/cxfa_fwltheme.cpp
+++ b/xfa/fxfa/cxfa_fwltheme.cpp
@@ -24,6 +24,7 @@
#include "xfa/fwl/cfwl_themetext.h"
#include "xfa/fxfa/cxfa_ffapp.h"
#include "xfa/fxfa/cxfa_ffwidget.h"
+#include "xfa/fxfa/parser/cxfa_para.h"
#include "xfa/fxgraphics/cxfa_gecolor.h"
namespace {
@@ -154,11 +155,11 @@ CFX_RectF CXFA_FWLTheme::GetUIMargin(CFWL_ThemePart* pThemePart) const {
CXFA_LayoutItem* pItem = pWidget;
CXFA_WidgetAcc* pWidgetAcc = pWidget->GetDataAcc();
rect = pWidgetAcc->GetUIMargin();
- CXFA_ParaData paraData = pWidgetAcc->GetParaData();
- if (paraData.HasValidNode()) {
- rect.left += paraData.GetMarginLeft();
+ CXFA_Para* para = pWidgetAcc->GetPara();
+ if (para) {
+ rect.left += para->GetMarginLeft();
if (pWidgetAcc->IsMultiLine())
- rect.width += paraData.GetMarginRight();
+ rect.width += para->GetMarginRight();
}
if (!pItem->GetPrev()) {
if (pItem->GetNext())
@@ -213,10 +214,10 @@ CFX_SizeF CXFA_FWLTheme::GetSpaceAboveBelow(CFWL_ThemePart* pThemePart) const {
CFX_SizeF sizeAboveBelow;
if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) {
CXFA_WidgetAcc* pWidgetAcc = pWidget->GetDataAcc();
- CXFA_ParaData paraData = pWidgetAcc->GetParaData();
- if (paraData.HasValidNode()) {
- sizeAboveBelow.width = paraData.GetSpaceAbove();
- sizeAboveBelow.height = paraData.GetSpaceBelow();
+ CXFA_Para* para = pWidgetAcc->GetPara();
+ if (para) {
+ sizeAboveBelow.width = para->GetSpaceAbove();
+ sizeAboveBelow.height = para->GetSpaceBelow();
}
}
return sizeAboveBelow;
diff --git a/xfa/fxfa/cxfa_textlayout.cpp b/xfa/fxfa/cxfa_textlayout.cpp
index 85ec36998b..133f564deb 100644
--- a/xfa/fxfa/cxfa_textlayout.cpp
+++ b/xfa/fxfa/cxfa_textlayout.cpp
@@ -29,7 +29,7 @@
#include "xfa/fxfa/cxfa_textuserdata.h"
#include "xfa/fxfa/parser/cxfa_fontdata.h"
#include "xfa/fxfa/parser/cxfa_node.h"
-#include "xfa/fxfa/parser/cxfa_paradata.h"
+#include "xfa/fxfa/parser/cxfa_para.h"
#define XFA_LOADERCNTXTFLG_FILTERSPACE 0x001
@@ -102,12 +102,12 @@ std::unique_ptr<CFX_RTFBreak> CXFA_TextLayout::CreateBreak(bool bDefault) {
}
void CXFA_TextLayout::InitBreak(float fLineWidth) {
- CXFA_ParaData paraData = m_pTextProvider->GetParaData();
+ CXFA_Para* para = m_pTextProvider->GetPara();
float fStart = 0;
float fStartPos = 0;
- if (paraData.HasValidNode()) {
+ if (para) {
CFX_RTFLineAlignment iAlign = CFX_RTFLineAlignment::Left;
- switch (paraData.GetHorizontalAlign()) {
+ switch (para->GetHorizontalAlign()) {
case XFA_AttributeEnum::Center:
iAlign = CFX_RTFLineAlignment::Center;
break;
@@ -129,18 +129,18 @@ void CXFA_TextLayout::InitBreak(float fLineWidth) {
}
m_pBreak->SetAlignment(iAlign);
- fStart = paraData.GetMarginLeft();
+ fStart = para->GetMarginLeft();
if (m_pTextProvider->IsCheckButtonAndAutoWidth()) {
if (iAlign != CFX_RTFLineAlignment::Left)
- fLineWidth -= paraData.GetMarginRight();
+ fLineWidth -= para->GetMarginRight();
} else {
- fLineWidth -= paraData.GetMarginRight();
+ fLineWidth -= para->GetMarginRight();
}
if (fLineWidth < 0)
fLineWidth = fStart;
fStartPos = fStart;
- float fIndent = paraData.GetTextIndent();
+ float fIndent = para->GetTextIndent();
if (fIndent > 0)
fStartPos += fIndent;
}
@@ -651,14 +651,14 @@ void CXFA_TextLayout::LoadText(CXFA_Node* pNode,
bool bSavePieces) {
InitBreak(textWidth);
- CXFA_ParaData paraData = m_pTextProvider->GetParaData();
+ CXFA_Para* para = m_pTextProvider->GetPara();
float fSpaceAbove = 0;
- if (paraData.HasValidNode()) {
- fSpaceAbove = paraData.GetSpaceAbove();
+ if (para) {
+ fSpaceAbove = para->GetSpaceAbove();
if (fSpaceAbove < 0.1f)
fSpaceAbove = 0;
- switch (paraData.GetVerticalAlign()) {
+ switch (para->GetVerticalAlign()) {
case XFA_AttributeEnum::Top:
case XFA_AttributeEnum::Middle:
case XFA_AttributeEnum::Bottom: {
@@ -1099,14 +1099,14 @@ void CXFA_TextLayout::AppendTextLine(CFX_BreakType dwStatus,
if (dwStatus == CFX_BreakType::Paragraph) {
m_pBreak->Reset();
if (!pStyle && bEndBreak) {
- CXFA_ParaData paraData = m_pTextProvider->GetParaData();
- if (paraData.HasValidNode()) {
- float fStartPos = paraData.GetMarginLeft();
- float fIndent = paraData.GetTextIndent();
+ CXFA_Para* para = m_pTextProvider->GetPara();
+ if (para) {
+ float fStartPos = para->GetMarginLeft();
+ float fIndent = para->GetTextIndent();
if (fIndent > 0)
fStartPos += fIndent;
- float fSpaceBelow = paraData.GetSpaceBelow();
+ float fSpaceBelow = para->GetSpaceBelow();
if (fSpaceBelow < 0.1f)
fSpaceBelow = 0;
diff --git a/xfa/fxfa/cxfa_textparser.cpp b/xfa/fxfa/cxfa_textparser.cpp
index 9260ab0835..ecee36a9f1 100644
--- a/xfa/fxfa/cxfa_textparser.cpp
+++ b/xfa/fxfa/cxfa_textparser.cpp
@@ -26,6 +26,7 @@
#include "xfa/fxfa/cxfa_textprovider.h"
#include "xfa/fxfa/cxfa_texttabstopscontext.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
+#include "xfa/fxfa/parser/cxfa_para.h"
namespace {
@@ -91,18 +92,18 @@ std::unique_ptr<CFX_CSSStyleSheet> CXFA_TextParser::LoadDefaultSheetStyle() {
RetainPtr<CFX_CSSComputedStyle> CXFA_TextParser::CreateRootStyle(
CXFA_TextProvider* pTextProvider) {
- CXFA_ParaData paraData = pTextProvider->GetParaData();
+ CXFA_Para* para = pTextProvider->GetPara();
auto pStyle = m_pSelector->CreateComputedStyle(nullptr);
float fLineHeight = 0;
float fFontSize = 10;
- if (paraData.HasValidNode()) {
- fLineHeight = paraData.GetLineHeight();
+ if (para) {
+ fLineHeight = para->GetLineHeight();
CFX_CSSLength indent;
- indent.Set(CFX_CSSLengthUnit::Point, paraData.GetTextIndent());
+ indent.Set(CFX_CSSLengthUnit::Point, para->GetTextIndent());
pStyle->SetTextIndent(indent);
CFX_CSSTextAlign hAlign = CFX_CSSTextAlign::Left;
- switch (paraData.GetHorizontalAlign()) {
+ switch (para->GetHorizontalAlign()) {
case XFA_AttributeEnum::Center:
hAlign = CFX_CSSTextAlign::Center;
break;
@@ -124,12 +125,10 @@ RetainPtr<CFX_CSSComputedStyle> CXFA_TextParser::CreateRootStyle(
}
pStyle->SetTextAlign(hAlign);
CFX_CSSRect rtMarginWidth;
- rtMarginWidth.left.Set(CFX_CSSLengthUnit::Point, paraData.GetMarginLeft());
- rtMarginWidth.top.Set(CFX_CSSLengthUnit::Point, paraData.GetSpaceAbove());
- rtMarginWidth.right.Set(CFX_CSSLengthUnit::Point,
- paraData.GetMarginRight());
- rtMarginWidth.bottom.Set(CFX_CSSLengthUnit::Point,
- paraData.GetSpaceBelow());
+ rtMarginWidth.left.Set(CFX_CSSLengthUnit::Point, para->GetMarginLeft());
+ rtMarginWidth.top.Set(CFX_CSSLengthUnit::Point, para->GetSpaceAbove());
+ rtMarginWidth.right.Set(CFX_CSSLengthUnit::Point, para->GetMarginRight());
+ rtMarginWidth.bottom.Set(CFX_CSSLengthUnit::Point, para->GetSpaceBelow());
pStyle->SetMarginWidth(rtMarginWidth);
}
@@ -299,9 +298,8 @@ std::unique_ptr<CXFA_TextParser::TagProvider> CXFA_TextParser::ParseTagInfo(
XFA_AttributeEnum CXFA_TextParser::GetVAlign(
CXFA_TextProvider* pTextProvider) const {
- CXFA_ParaData paraData = pTextProvider->GetParaData();
- return paraData.HasValidNode() ? paraData.GetVerticalAlign()
- : XFA_AttributeEnum::Top;
+ CXFA_Para* para = pTextProvider->GetPara();
+ return para ? para->GetVerticalAlign() : XFA_AttributeEnum::Top;
}
float CXFA_TextParser::GetTabInterval(CFX_CSSComputedStyle* pStyle) const {
@@ -483,9 +481,9 @@ float CXFA_TextParser::GetLineHeight(CXFA_TextProvider* pTextProvider,
if (pStyle) {
fLineHeight = pStyle->GetLineHeight();
} else {
- CXFA_ParaData paraData = pTextProvider->GetParaData();
- if (paraData.HasValidNode())
- fLineHeight = paraData.GetLineHeight();
+ CXFA_Para* para = pTextProvider->GetPara();
+ if (para)
+ fLineHeight = para->GetLineHeight();
}
if (bFirst) {
diff --git a/xfa/fxfa/cxfa_textprovider.cpp b/xfa/fxfa/cxfa_textprovider.cpp
index 4795ab8cfb..461fa5dde4 100644
--- a/xfa/fxfa/cxfa_textprovider.cpp
+++ b/xfa/fxfa/cxfa_textprovider.cpp
@@ -117,13 +117,13 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) {
return nullptr;
}
-CXFA_ParaData CXFA_TextProvider::GetParaData() {
+CXFA_Para* CXFA_TextProvider::GetPara() {
if (m_eType == XFA_TEXTPROVIDERTYPE_Text)
- return m_pWidgetAcc->GetParaData();
+ return m_pWidgetAcc->GetPara();
CXFA_Caption* pNode = m_pWidgetAcc->GetNode()->GetChild<CXFA_Caption>(
0, XFA_Element::Caption, false);
- return CXFA_ParaData(pNode->GetChild<CXFA_Para>(0, XFA_Element::Para, false));
+ return pNode->GetChild<CXFA_Para>(0, XFA_Element::Para, false);
}
CXFA_FontData CXFA_TextProvider::GetFontData() {
diff --git a/xfa/fxfa/cxfa_textprovider.h b/xfa/fxfa/cxfa_textprovider.h
index df4de8beb7..ae51fc318a 100644
--- a/xfa/fxfa/cxfa_textprovider.h
+++ b/xfa/fxfa/cxfa_textprovider.h
@@ -11,7 +11,6 @@
#include "xfa/fxfa/cxfa_textlayout.h"
#include "xfa/fxfa/cxfa_widgetacc.h"
#include "xfa/fxfa/parser/cxfa_fontdata.h"
-#include "xfa/fxfa/parser/cxfa_paradata.h"
class CXFA_FFDoc;
class CXFA_Node;
@@ -33,7 +32,7 @@ class CXFA_TextProvider {
~CXFA_TextProvider() {}
CXFA_Node* GetTextNode(bool& bRichText);
- CXFA_ParaData GetParaData();
+ CXFA_Para* GetPara();
CXFA_FontData GetFontData();
bool IsCheckButtonAndAutoWidth();
CXFA_FFDoc* GetDocNode() { return m_pWidgetAcc->GetDoc(); }
diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp
index 76b4f46e20..63f59dcc28 100644
--- a/xfa/fxfa/cxfa_widgetacc.cpp
+++ b/xfa/fxfa/cxfa_widgetacc.cpp
@@ -25,6 +25,7 @@
#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
#include "xfa/fxfa/parser/cxfa_localevalue.h"
#include "xfa/fxfa/parser/cxfa_node.h"
+#include "xfa/fxfa/parser/cxfa_para.h"
#include "xfa/fxfa/parser/cxfa_script.h"
#include "xfa/fxfa/parser/cxfa_validate.h"
#include "xfa/fxfa/parser/cxfa_value.h"
@@ -772,9 +773,9 @@ bool CXFA_WidgetAcc::CalculateWidgetAutoSize(CFX_SizeF& size) {
size.height += marginData.GetTopInset() + marginData.GetBottomInset();
}
- CXFA_ParaData paraData = GetParaData();
- if (paraData.HasValidNode())
- size.width += paraData.GetMarginLeft() + paraData.GetTextIndent();
+ CXFA_Para* para = GetPara();
+ if (para)
+ size.width += para->GetMarginLeft() + para->GetTextIndent();
pdfium::Optional<float> width = TryWidth();
if (width) {
@@ -1231,12 +1232,12 @@ bool CXFA_WidgetAcc::FindSplitPos(int32_t iBlockIndex, float& fCalcHeight) {
if (fHeight > 0.1f && iBlockIndex == 0) {
fStartOffset = fTopInset;
fHeight -= (fTopInset + fBottomInset);
- CXFA_ParaData paraData = GetParaData();
- if (paraData.HasValidNode()) {
- fSpaceAbove = paraData.GetSpaceAbove();
- float fSpaceBelow = paraData.GetSpaceBelow();
+ CXFA_Para* para = GetPara();
+ if (para) {
+ fSpaceAbove = para->GetSpaceAbove();
+ float fSpaceBelow = para->GetSpaceBelow();
fHeight -= (fSpaceAbove + fSpaceBelow);
- switch (paraData.GetVerticalAlign()) {
+ switch (para->GetVerticalAlign()) {
case XFA_AttributeEnum::Top:
fStartOffset += fSpaceAbove;
break;
@@ -1503,9 +1504,9 @@ float CXFA_WidgetAcc::GetFontSize() {
float CXFA_WidgetAcc::GetLineHeight() {
float fLineHeight = 0;
- CXFA_ParaData paraData = GetParaData();
- if (paraData.HasValidNode())
- fLineHeight = paraData.GetLineHeight();
+ CXFA_Para* para = GetPara();
+ if (para)
+ fLineHeight = para->GetLineHeight();
if (fLineHeight < 1)
fLineHeight = GetFontSize() * 1.2f;
return fLineHeight;
diff --git a/xfa/fxfa/parser/cxfa_para.cpp b/xfa/fxfa/parser/cxfa_para.cpp
index fa91eb6a3d..ad7190dd1f 100644
--- a/xfa/fxfa/parser/cxfa_para.cpp
+++ b/xfa/fxfa/parser/cxfa_para.cpp
@@ -8,6 +8,7 @@
#include "fxjs/xfa/cjx_para.h"
#include "third_party/base/ptr_util.h"
+#include "xfa/fxfa/parser/cxfa_measurement.h"
namespace {
@@ -52,3 +53,41 @@ CXFA_Para::CXFA_Para(CXFA_Document* doc, XFA_PacketType packet)
pdfium::MakeUnique<CJX_Para>(this)) {}
CXFA_Para::~CXFA_Para() {}
+
+XFA_AttributeEnum CXFA_Para::GetHorizontalAlign() {
+ return JSObject()
+ ->TryEnum(XFA_Attribute::HAlign, true)
+ .value_or(XFA_AttributeEnum::Left);
+}
+
+XFA_AttributeEnum CXFA_Para::GetVerticalAlign() {
+ return JSObject()
+ ->TryEnum(XFA_Attribute::VAlign, true)
+ .value_or(XFA_AttributeEnum::Top);
+}
+
+float CXFA_Para::GetLineHeight() {
+ return JSObject()->GetMeasure(XFA_Attribute::LineHeight).ToUnit(XFA_Unit::Pt);
+}
+
+float CXFA_Para::GetMarginLeft() {
+ return JSObject()->GetMeasure(XFA_Attribute::MarginLeft).ToUnit(XFA_Unit::Pt);
+}
+
+float CXFA_Para::GetMarginRight() {
+ return JSObject()
+ ->GetMeasure(XFA_Attribute::MarginRight)
+ .ToUnit(XFA_Unit::Pt);
+}
+
+float CXFA_Para::GetSpaceAbove() {
+ return JSObject()->GetMeasure(XFA_Attribute::SpaceAbove).ToUnit(XFA_Unit::Pt);
+}
+
+float CXFA_Para::GetSpaceBelow() {
+ return JSObject()->GetMeasure(XFA_Attribute::SpaceBelow).ToUnit(XFA_Unit::Pt);
+}
+
+float CXFA_Para::GetTextIndent() {
+ return JSObject()->GetMeasure(XFA_Attribute::TextIndent).ToUnit(XFA_Unit::Pt);
+}
diff --git a/xfa/fxfa/parser/cxfa_para.h b/xfa/fxfa/parser/cxfa_para.h
index 47c4d85eb8..afb48ce819 100644
--- a/xfa/fxfa/parser/cxfa_para.h
+++ b/xfa/fxfa/parser/cxfa_para.h
@@ -13,6 +13,15 @@ class CXFA_Para : public CXFA_Node {
public:
CXFA_Para(CXFA_Document* doc, XFA_PacketType packet);
~CXFA_Para() override;
+
+ XFA_AttributeEnum GetHorizontalAlign();
+ XFA_AttributeEnum GetVerticalAlign();
+ float GetLineHeight();
+ float GetMarginLeft();
+ float GetMarginRight();
+ float GetSpaceAbove();
+ float GetSpaceBelow();
+ float GetTextIndent();
};
#endif // XFA_FXFA_PARSER_CXFA_PARA_H_
diff --git a/xfa/fxfa/parser/cxfa_paradata.cpp b/xfa/fxfa/parser/cxfa_paradata.cpp
deleted file mode 100644
index 7dfd924675..0000000000
--- a/xfa/fxfa/parser/cxfa_paradata.cpp
+++ /dev/null
@@ -1,60 +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_paradata.h"
-
-#include "xfa/fxfa/parser/cxfa_measurement.h"
-#include "xfa/fxfa/parser/cxfa_node.h"
-
-CXFA_ParaData::CXFA_ParaData(CXFA_Node* pNode) : CXFA_DataData(pNode) {}
-
-XFA_AttributeEnum CXFA_ParaData::GetHorizontalAlign() const {
- return m_pNode->JSObject()
- ->TryEnum(XFA_Attribute::HAlign, true)
- .value_or(XFA_AttributeEnum::Left);
-}
-
-XFA_AttributeEnum CXFA_ParaData::GetVerticalAlign() const {
- return m_pNode->JSObject()
- ->TryEnum(XFA_Attribute::VAlign, true)
- .value_or(XFA_AttributeEnum::Top);
-}
-
-float CXFA_ParaData::GetLineHeight() const {
- return m_pNode->JSObject()
- ->GetMeasure(XFA_Attribute::LineHeight)
- .ToUnit(XFA_Unit::Pt);
-}
-
-float CXFA_ParaData::GetMarginLeft() const {
- return m_pNode->JSObject()
- ->GetMeasure(XFA_Attribute::MarginLeft)
- .ToUnit(XFA_Unit::Pt);
-}
-
-float CXFA_ParaData::GetMarginRight() const {
- return m_pNode->JSObject()
- ->GetMeasure(XFA_Attribute::MarginRight)
- .ToUnit(XFA_Unit::Pt);
-}
-
-float CXFA_ParaData::GetSpaceAbove() const {
- return m_pNode->JSObject()
- ->GetMeasure(XFA_Attribute::SpaceAbove)
- .ToUnit(XFA_Unit::Pt);
-}
-
-float CXFA_ParaData::GetSpaceBelow() const {
- return m_pNode->JSObject()
- ->GetMeasure(XFA_Attribute::SpaceBelow)
- .ToUnit(XFA_Unit::Pt);
-}
-
-float CXFA_ParaData::GetTextIndent() const {
- return m_pNode->JSObject()
- ->GetMeasure(XFA_Attribute::TextIndent)
- .ToUnit(XFA_Unit::Pt);
-}
diff --git a/xfa/fxfa/parser/cxfa_paradata.h b/xfa/fxfa/parser/cxfa_paradata.h
deleted file mode 100644
index f5859f3e5d..0000000000
--- a/xfa/fxfa/parser/cxfa_paradata.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_PARADATA_H_
-#define XFA_FXFA_PARSER_CXFA_PARADATA_H_
-
-#include "core/fxcrt/fx_system.h"
-#include "xfa/fxfa/parser/cxfa_datadata.h"
-
-class CXFA_Node;
-
-class CXFA_ParaData : public CXFA_DataData {
- public:
- explicit CXFA_ParaData(CXFA_Node* pNode);
-
- XFA_AttributeEnum GetHorizontalAlign() const;
- XFA_AttributeEnum GetVerticalAlign() const;
- float GetLineHeight() const;
- float GetMarginLeft() const;
- float GetMarginRight() const;
- float GetSpaceAbove() const;
- float GetSpaceBelow() const;
- float GetTextIndent() const;
-};
-
-#endif // XFA_FXFA_PARSER_CXFA_PARADATA_H_
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp
index fd722ad464..6e68ee356b 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.cpp
+++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp
@@ -280,9 +280,9 @@ CXFA_MarginData CXFA_WidgetData::GetMarginData() {
0, XFA_Element::Margin, false));
}
-CXFA_ParaData CXFA_WidgetData::GetParaData() {
- return CXFA_ParaData(
- m_pNode->JSObject()->GetProperty<CXFA_Para>(0, XFA_Element::Para, false));
+CXFA_Para* CXFA_WidgetData::GetPara() {
+ return m_pNode->JSObject()->GetProperty<CXFA_Para>(0, XFA_Element::Para,
+ false);
}
std::vector<CXFA_Node*> CXFA_WidgetData::GetEventList() {
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.h b/xfa/fxfa/parser/cxfa_widgetdata.h
index 21e4e848ec..2873ff9bc1 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.h
+++ b/xfa/fxfa/parser/cxfa_widgetdata.h
@@ -21,7 +21,6 @@
#include "xfa/fxfa/parser/cxfa_datadata.h"
#include "xfa/fxfa/parser/cxfa_fontdata.h"
#include "xfa/fxfa/parser/cxfa_margindata.h"
-#include "xfa/fxfa/parser/cxfa_paradata.h"
enum XFA_CHECKSTATE {
XFA_CHECKSTATE_On = 0,
@@ -37,6 +36,7 @@ enum XFA_VALUEPICTURE {
};
class CXFA_Node;
+class CXFA_Para;
class CXFA_Validate;
class IFX_Locale;
@@ -62,7 +62,7 @@ class CXFA_WidgetData : public CXFA_DataData {
CXFA_CaptionData GetCaptionData();
CXFA_FontData GetFontData(bool bModified);
CXFA_MarginData GetMarginData();
- CXFA_ParaData GetParaData();
+ CXFA_Para* GetPara();
CXFA_Value* GetDefaultValue();
CXFA_Value* GetFormValue();
CXFA_CalculateData GetCalculateData();