summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fxfa/cxfa_ffcheckbutton.cpp10
-rw-r--r--xfa/fxfa/cxfa_fffield.cpp28
-rw-r--r--xfa/fxfa/cxfa_fffield.h4
-rw-r--r--xfa/fxfa/cxfa_ffpushbutton.cpp12
-rw-r--r--xfa/fxfa/cxfa_widgetacc.cpp33
-rw-r--r--xfa/fxfa/parser/cxfa_captiondata.cpp (renamed from xfa/fxfa/parser/cxfa_caption.cpp)16
-rw-r--r--xfa/fxfa/parser/cxfa_captiondata.h (renamed from xfa/fxfa/parser/cxfa_caption.h)10
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.h4
9 files changed, 61 insertions, 60 deletions
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<CXFA_TextProvider>(
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_captiondata.cpp
index 3f820e437e..db18f9a159 100644
--- a/xfa/fxfa/parser/cxfa_caption.cpp
+++ b/xfa/fxfa/parser/cxfa_captiondata.cpp
@@ -4,42 +4,42 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/parser/cxfa_caption.h"
+#include "xfa/fxfa/parser/cxfa_captiondata.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) {}
+CXFA_CaptionData::CXFA_CaptionData(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-int32_t CXFA_Caption::GetPresence() {
+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_Caption::GetPlacementType() {
+int32_t CXFA_CaptionData::GetPlacementType() {
XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_Left;
m_pNode->JSNode()->TryEnum(XFA_ATTRIBUTE_Placement, eAttr, true);
return eAttr;
}
-float CXFA_Caption::GetReserve() {
+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_Caption::GetMargin() {
+CXFA_Margin CXFA_CaptionData::GetMargin() {
return CXFA_Margin(m_pNode ? m_pNode->GetChild(0, XFA_Element::Margin, false)
: nullptr);
}
-CXFA_Font CXFA_Caption::GetFont() {
+CXFA_Font CXFA_CaptionData::GetFont() {
return CXFA_Font(m_pNode ? m_pNode->GetChild(0, XFA_Element::Font, false)
: nullptr);
}
-CXFA_Value CXFA_Caption::GetValue() {
+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_caption.h b/xfa/fxfa/parser/cxfa_captiondata.h
index 74650ef9a2..605a837a1b 100644
--- a/xfa/fxfa/parser/cxfa_caption.h
+++ b/xfa/fxfa/parser/cxfa_captiondata.h
@@ -4,8 +4,8 @@
// 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_
+#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"
@@ -14,9 +14,9 @@
class CXFA_Node;
-class CXFA_Caption : public CXFA_Data {
+class CXFA_CaptionData : public CXFA_Data {
public:
- explicit CXFA_Caption(CXFA_Node* pNode);
+ explicit CXFA_CaptionData(CXFA_Node* pNode);
int32_t GetPresence();
int32_t GetPlacementType();
@@ -26,4 +26,4 @@ class CXFA_Caption : public CXFA_Data {
CXFA_Value GetValue();
};
-#endif // XFA_FXFA_PARSER_CXFA_CAPTION_H_
+#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();