summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xfa/fxfa/cxfa_ffbarcode.cpp2
-rw-r--r--xfa/fxfa/cxfa_ffcombobox.cpp7
-rw-r--r--xfa/fxfa/cxfa_ffdatetimeedit.cpp2
-rw-r--r--xfa/fxfa/cxfa_fffield.cpp13
-rw-r--r--xfa/fxfa/cxfa_ffimageedit.cpp2
-rw-r--r--xfa/fxfa/cxfa_ffnumericedit.cpp2
-rw-r--r--xfa/fxfa/cxfa_ffpasswordedit.cpp2
-rw-r--r--xfa/fxfa/cxfa_fftextedit.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.cpp18
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.h67
10 files changed, 64 insertions, 55 deletions
diff --git a/xfa/fxfa/cxfa_ffbarcode.cpp b/xfa/fxfa/cxfa_ffbarcode.cpp
index 5dd30dcf56..726f89176f 100644
--- a/xfa/fxfa/cxfa_ffbarcode.cpp
+++ b/xfa/fxfa/cxfa_ffbarcode.cpp
@@ -211,7 +211,7 @@ bool CXFA_FFBarcode::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
auto* pBarCodeWidget = static_cast<CFWL_Barcode*>(m_pNormalWidget.get());
if (!pBarCodeWidget || pBarCodeWidget->IsProtectedType())
return false;
- if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open)
+ if (!m_pDataAcc->IsOpenAccess())
return false;
return CXFA_FFTextEdit::OnLButtonDown(dwFlags, point);
}
diff --git a/xfa/fxfa/cxfa_ffcombobox.cpp b/xfa/fxfa/cxfa_ffcombobox.cpp
index 87c1c3e43f..87e14d205f 100644
--- a/xfa/fxfa/cxfa_ffcombobox.cpp
+++ b/xfa/fxfa/cxfa_ffcombobox.cpp
@@ -80,7 +80,7 @@ void CXFA_FFComboBox::UpdateWidgetProperty() {
dwEditStyles &= ~FWL_STYLEEXT_EDT_ReadOnly;
dwExtendedStyle |= FWL_STYLEEXT_CMB_DropDown;
}
- if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open ||
+ if (!m_pDataAcc->IsOpenAccess() ||
!m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) {
dwEditStyles |= FWL_STYLEEXT_EDT_ReadOnly;
dwExtendedStyle |= FWL_STYLEEXT_CMB_ReadOnly;
@@ -227,14 +227,13 @@ bool CXFA_FFComboBox::CanCopy() {
}
bool CXFA_FFComboBox::CanCut() {
- return m_pDataAcc->GetAccess() == XFA_ATTRIBUTEENUM_Open &&
+ return m_pDataAcc->IsOpenAccess() &&
m_pDataAcc->IsChoiceListAllowTextEntry() &&
ToComboBox(m_pNormalWidget.get())->EditCanCut();
}
bool CXFA_FFComboBox::CanPaste() {
- return m_pDataAcc->IsChoiceListAllowTextEntry() &&
- m_pDataAcc->GetAccess() == XFA_ATTRIBUTEENUM_Open;
+ return m_pDataAcc->IsChoiceListAllowTextEntry() && m_pDataAcc->IsOpenAccess();
}
bool CXFA_FFComboBox::CanSelectAll() {
diff --git a/xfa/fxfa/cxfa_ffdatetimeedit.cpp b/xfa/fxfa/cxfa_ffdatetimeedit.cpp
index 1b2f6e3221..4b8f39704d 100644
--- a/xfa/fxfa/cxfa_ffdatetimeedit.cpp
+++ b/xfa/fxfa/cxfa_ffdatetimeedit.cpp
@@ -86,7 +86,7 @@ void CXFA_FFDateTimeEdit::UpdateWidgetProperty() {
dwEditStyles |= FWL_STYLEEXT_EDT_CombText;
pWidget->SetEditLimit(iNumCells);
}
- if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open ||
+ if (!m_pDataAcc->IsOpenAccess() ||
!m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) {
dwEditStyles |= FWL_STYLEEXT_EDT_ReadOnly;
}
diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp
index ca3d2bb047..70b11640ec 100644
--- a/xfa/fxfa/cxfa_fffield.cpp
+++ b/xfa/fxfa/cxfa_fffield.cpp
@@ -81,11 +81,8 @@ void CXFA_FFField::DrawHighlight(CXFA_Graphics* pGS,
bool bEllipse) {
if (m_rtUI.IsEmpty() || !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive())
return;
-
- if (!(dwStatus & XFA_WidgetStatus_Highlight) ||
- m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open) {
+ if (!(dwStatus & XFA_WidgetStatus_Highlight) || !m_pDataAcc->IsOpenAccess())
return;
- }
CXFA_FFDoc* pDoc = GetDoc();
pGS->SetFillColor(
@@ -387,7 +384,7 @@ CFX_PointF CXFA_FFField::FWLToClient(const CFX_PointF& point) {
bool CXFA_FFField::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
if (!m_pNormalWidget)
return false;
- if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open ||
+ if (!m_pDataAcc->IsOpenAccess() ||
!m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) {
return false;
}
@@ -459,7 +456,7 @@ bool CXFA_FFField::OnMouseWheel(uint32_t dwFlags,
bool CXFA_FFField::OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
if (!m_pNormalWidget)
return false;
- if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open ||
+ if (!m_pDataAcc->IsOpenAccess() ||
!m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) {
return false;
}
@@ -558,7 +555,7 @@ bool CXFA_FFField::OnChar(uint32_t dwChar, uint32_t dwFlags) {
return true;
if (!m_pNormalWidget)
return false;
- if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open)
+ if (!m_pDataAcc->IsOpenAccess())
return false;
CFWL_MessageKey ms(nullptr, m_pNormalWidget.get());
@@ -627,7 +624,7 @@ void CXFA_FFField::RenderCaption(CXFA_Graphics* pGS, CFX_Matrix* pMatrix) {
}
bool CXFA_FFField::ProcessCommittedData() {
- if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open)
+ if (!m_pDataAcc->IsOpenAccess())
return false;
if (!IsDataChanged())
return false;
diff --git a/xfa/fxfa/cxfa_ffimageedit.cpp b/xfa/fxfa/cxfa_ffimageedit.cpp
index 9a1d1e12cf..3736997ee9 100644
--- a/xfa/fxfa/cxfa_ffimageedit.cpp
+++ b/xfa/fxfa/cxfa_ffimageedit.cpp
@@ -93,7 +93,7 @@ void CXFA_FFImageEdit::RenderWidget(CXFA_Graphics* pGS,
bool CXFA_FFImageEdit::OnLButtonDown(uint32_t dwFlags,
const CFX_PointF& point) {
- if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open)
+ if (!m_pDataAcc->IsOpenAccess())
return false;
if (!PtInActiveRect(point))
return false;
diff --git a/xfa/fxfa/cxfa_ffnumericedit.cpp b/xfa/fxfa/cxfa_ffnumericedit.cpp
index f6199561a4..8f020351c2 100644
--- a/xfa/fxfa/cxfa_ffnumericedit.cpp
+++ b/xfa/fxfa/cxfa_ffnumericedit.cpp
@@ -61,7 +61,7 @@ void CXFA_FFNumericEdit::UpdateWidgetProperty() {
pWidget->SetLimit(iNumCells);
}
dwExtendedStyle |= GetAlignment();
- if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open ||
+ if (!m_pDataAcc->IsOpenAccess() ||
!m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) {
dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly;
}
diff --git a/xfa/fxfa/cxfa_ffpasswordedit.cpp b/xfa/fxfa/cxfa_ffpasswordedit.cpp
index 7e2f6cd29a..8cbe265b7a 100644
--- a/xfa/fxfa/cxfa_ffpasswordedit.cpp
+++ b/xfa/fxfa/cxfa_ffpasswordedit.cpp
@@ -56,7 +56,7 @@ void CXFA_FFPasswordEdit::UpdateWidgetProperty() {
pWidget->SetAliasChar(wsPassWord[0]);
if (m_pDataAcc->GetHorizontalScrollPolicy() != XFA_ATTRIBUTEENUM_Off)
dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoHScroll;
- if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open ||
+ if (!m_pDataAcc->IsOpenAccess() ||
!m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) {
dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly;
}
diff --git a/xfa/fxfa/cxfa_fftextedit.cpp b/xfa/fxfa/cxfa_fftextedit.cpp
index f3be75d2a4..abc8e9997c 100644
--- a/xfa/fxfa/cxfa_fftextedit.cpp
+++ b/xfa/fxfa/cxfa_fftextedit.cpp
@@ -81,7 +81,7 @@ void CXFA_FFTextEdit::UpdateWidgetProperty() {
} else if (m_pDataAcc->GetHorizontalScrollPolicy() != XFA_ATTRIBUTEENUM_Off) {
dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoHScroll;
}
- if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open ||
+ if (!m_pDataAcc->IsOpenAccess() ||
!m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) {
dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly;
dwExtendedStyle |= FWL_STYLEEXT_EDT_MultiLine;
@@ -126,7 +126,7 @@ bool CXFA_FFTextEdit::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
}
bool CXFA_FFTextEdit::OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
- if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open)
+ if (!m_pDataAcc->IsOpenAccess())
return false;
if (!PtInActiveRect(point))
return false;
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp
index 13b1c7a3ae..9b0bbccde8 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.cpp
+++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp
@@ -219,21 +219,19 @@ XFA_Element CXFA_WidgetData::GetUIType() {
return m_eUIType;
}
-WideString CXFA_WidgetData::GetRawValue() {
+WideString CXFA_WidgetData::GetRawValue() const {
return m_pNode->JSNode()->GetContent(false);
}
-int32_t CXFA_WidgetData::GetAccess() {
- CXFA_Node* pNode = m_pNode;
- while (pNode) {
- int32_t iAcc = pNode->JSNode()->GetEnum(XFA_Attribute::Access);
+bool CXFA_WidgetData::IsOpenAccess() const {
+ for (CXFA_Node* pNode = m_pNode; pNode;
+ pNode = pNode->GetNodeItem(XFA_NODEITEM_Parent,
+ XFA_ObjectType::ContainerNode)) {
+ XFA_ATTRIBUTEENUM iAcc = pNode->JSNode()->GetEnum(XFA_Attribute::Access);
if (iAcc != XFA_ATTRIBUTEENUM_Open)
- return iAcc;
-
- pNode =
- pNode->GetNodeItem(XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode);
+ return false;
}
- return XFA_ATTRIBUTEENUM_Open;
+ return true;
}
int32_t CXFA_WidgetData::GetRotate() {
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.h b/xfa/fxfa/parser/cxfa_widgetdata.h
index 309f00fe12..c6f07e2f2a 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.h
+++ b/xfa/fxfa/parser/cxfa_widgetdata.h
@@ -44,22 +44,31 @@ class CXFA_WidgetData : public CXFA_DataData {
CXFA_Node* GetUIChild();
XFA_Element GetUIType();
- WideString GetRawValue();
- int32_t GetAccess();
+ CFX_RectF GetUIMargin();
+
+ WideString GetRawValue() const;
int32_t GetRotate();
+ bool IsOpenAccess() const;
+ bool IsListBox();
+ bool IsAllowNeutral();
+ bool IsRadioButton();
+ bool IsChoiceListAllowTextEntry();
+ bool IsMultiLine();
+
CXFA_BorderData GetBorderData(bool bModified);
CXFA_CaptionData GetCaptionData();
CXFA_FontData GetFontData(bool bModified);
CXFA_MarginData GetMarginData();
CXFA_ParaData GetParaData();
- std::vector<CXFA_Node*> GetEventList();
- std::vector<CXFA_Node*> GetEventByActivity(int32_t iActivity,
- bool bIsFormReady);
CXFA_ValueData GetDefaultValueData();
CXFA_ValueData GetFormValueData();
CXFA_CalculateData GetCalculateData();
CXFA_ValidateData GetValidateData(bool bModified);
+ CXFA_BorderData GetUIBorderData();
+
+ std::vector<CXFA_Node*> GetEventByActivity(int32_t iActivity,
+ bool bIsFormReady);
pdfium::Optional<float> TryWidth();
pdfium::Optional<float> TryHeight();
@@ -68,61 +77,66 @@ class CXFA_WidgetData : public CXFA_DataData {
pdfium::Optional<float> TryMaxWidth();
pdfium::Optional<float> TryMaxHeight();
- CXFA_BorderData GetUIBorderData();
- CFX_RectF GetUIMargin();
XFA_ATTRIBUTEENUM GetButtonHighlight();
bool GetButtonRollover(WideString& wsRollover, bool& bRichText);
bool GetButtonDown(WideString& wsDown, bool& bRichText);
+
XFA_ATTRIBUTEENUM GetCheckButtonShape();
XFA_ATTRIBUTEENUM GetCheckButtonMark();
float GetCheckButtonSize();
- bool IsAllowNeutral();
- bool IsRadioButton();
+
XFA_CHECKSTATE GetCheckState();
void SetCheckState(XFA_CHECKSTATE eCheckState, bool bNotify);
- CXFA_Node* GetExclGroupNode();
+
CXFA_Node* GetSelectedMember();
CXFA_Node* SetSelectedMember(const WideStringView& wsName, bool bNotify);
void SetSelectedMemberByValue(const WideStringView& wsValue,
bool bNotify,
bool bScriptModify,
bool bSyncData);
+
CXFA_Node* GetExclGroupFirstMember();
CXFA_Node* GetExclGroupNextMember(CXFA_Node* pNode);
- XFA_ATTRIBUTEENUM GetChoiceListCommitOn();
- bool IsChoiceListAllowTextEntry();
- XFA_ATTRIBUTEENUM GetChoiceListOpen();
- bool IsListBox();
+
int32_t CountChoiceListItems(bool bSaveValue);
bool GetChoiceListItem(WideString& wsText, int32_t nIndex, bool bSaveValue);
+ XFA_ATTRIBUTEENUM GetChoiceListOpen();
+ XFA_ATTRIBUTEENUM GetChoiceListCommitOn();
std::vector<WideString> GetChoiceListItems(bool bSaveValue);
+
int32_t CountSelectedItems();
int32_t GetSelectedItem(int32_t nIndex);
std::vector<int32_t> GetSelectedItems();
std::vector<WideString> GetSelectedItemsValue();
- bool GetItemState(int32_t nIndex);
- void SetItemState(int32_t nIndex,
- bool bSelected,
- bool bNotify,
- bool bScriptModify,
- bool bSyncData);
void SetSelectedItems(const std::vector<int32_t>& iSelArray,
bool bNotify,
bool bScriptModify,
bool bSyncData);
- void ClearAllSelections();
void InsertItem(const WideString& wsLabel,
const WideString& wsValue,
bool bNotify);
- void GetItemLabel(const WideStringView& wsValue, WideString& wsLabel);
- void GetItemValue(const WideStringView& wsLabel, WideString& wsValue);
bool DeleteItem(int32_t nIndex, bool bNotify, bool bScriptModify);
+ void ClearAllSelections();
+
+ bool GetItemState(int32_t nIndex);
+ void SetItemState(int32_t nIndex,
+ bool bSelected,
+ bool bNotify,
+ bool bScriptModify,
+ bool bSyncData);
+
+ void GetItemValue(const WideStringView& wsLabel, WideString& wsValue);
+
int32_t GetHorizontalScrollPolicy();
+ XFA_ATTRIBUTEENUM GetVerticalScrollPolicy();
int32_t GetNumberOfCells();
+
bool SetValue(const WideString& wsValue, XFA_VALUEPICTURE eValueType);
+ bool GetValue(WideString& wsValue, XFA_VALUEPICTURE eValueType);
+
WideString GetPictureContent(XFA_VALUEPICTURE ePicture);
IFX_Locale* GetLocal();
- bool GetValue(WideString& wsValue, XFA_VALUEPICTURE eValueType);
+
bool GetNormalizeDataValue(const WideString& wsValue,
WideString& wsNormalizeValue);
bool GetFormatDataValue(const WideString& wsValue,
@@ -144,8 +158,6 @@ class CXFA_WidgetData : public CXFA_DataData {
bool GetBarcodeAttribute_WideNarrowRatio(float* val);
void GetPasswordChar(WideString& wsPassWord);
- bool IsMultiLine();
- XFA_ATTRIBUTEENUM GetVerticalScrollPolicy();
int32_t GetMaxChars(XFA_Element& eType);
bool GetFracDigits(int32_t& iFracDigits);
bool GetLeadDigits(int32_t& iLeadDigits);
@@ -166,6 +178,9 @@ class CXFA_WidgetData : public CXFA_DataData {
void FormatNumStr(const WideString& wsValue,
IFX_Locale* pLocale,
WideString& wsOutput);
+ CXFA_Node* GetExclGroupNode();
+ void GetItemLabel(const WideStringView& wsValue, WideString& wsLabel);
+ std::vector<CXFA_Node*> GetEventList();
CXFA_Node* m_pUiChildNode;
XFA_Element m_eUIType;