summaryrefslogtreecommitdiff
path: root/xfa/fxfa/app
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-04-24 16:26:11 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-04-24 20:50:12 +0000
commited991c7d9d5bede7e3bb93ff6571512d875716dd (patch)
treef59ba63435f5c83db25c12c49ce798c274ee2608 /xfa/fxfa/app
parent302cd78d00c280cb212a5934a7a8293851e9650c (diff)
downloadpdfium-ed991c7d9d5bede7e3bb93ff6571512d875716dd.tar.xz
Nit cleanup in XFA widget code
This Cl cleans up nits in the remaining XFA widget code. Change-Id: I10f33ee2ab0ebdb06aeee582a04188fbd7a8bf9e Reviewed-on: https://pdfium-review.googlesource.com/4472 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/app')
-rw-r--r--xfa/fxfa/app/xfa_ffimage.cpp7
-rw-r--r--xfa/fxfa/app/xfa_ffimageedit.cpp2
-rw-r--r--xfa/fxfa/app/xfa_ffnotify.cpp148
-rw-r--r--xfa/fxfa/app/xfa_ffpushbutton.cpp13
-rw-r--r--xfa/fxfa/app/xfa_ffpushbutton.h2
-rw-r--r--xfa/fxfa/app/xfa_fftext.cpp6
-rw-r--r--xfa/fxfa/app/xfa_fftextedit.cpp239
-rw-r--r--xfa/fxfa/app/xfa_ffwidgetacc.cpp128
-rw-r--r--xfa/fxfa/app/xfa_ffwidgetacc.h7
9 files changed, 294 insertions, 258 deletions
diff --git a/xfa/fxfa/app/xfa_ffimage.cpp b/xfa/fxfa/app/xfa_ffimage.cpp
index 23ed88616d..db9b4de52a 100644
--- a/xfa/fxfa/app/xfa_ffimage.cpp
+++ b/xfa/fxfa/app/xfa_ffimage.cpp
@@ -21,16 +21,19 @@ CXFA_FFImage::~CXFA_FFImage() {
bool CXFA_FFImage::IsLoaded() {
return !!GetDataAcc()->GetImageImage();
}
+
bool CXFA_FFImage::LoadWidget() {
- if (GetDataAcc()->GetImageImage()) {
+ if (GetDataAcc()->GetImageImage())
return true;
- }
+
GetDataAcc()->LoadImageImage();
return CXFA_FFDraw::LoadWidget();
}
+
void CXFA_FFImage::UnloadWidget() {
GetDataAcc()->SetImageImage(nullptr);
}
+
void CXFA_FFImage::RenderWidget(CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
uint32_t dwStatus) {
diff --git a/xfa/fxfa/app/xfa_ffimageedit.cpp b/xfa/fxfa/app/xfa_ffimageedit.cpp
index dfc7e117d9..c8d9509aca 100644
--- a/xfa/fxfa/app/xfa_ffimageedit.cpp
+++ b/xfa/fxfa/app/xfa_ffimageedit.cpp
@@ -117,9 +117,11 @@ void CXFA_FFImageEdit::SetFWLRect() {
rtUIMargin.height);
m_pNormalWidget->SetWidgetRect(rtImage);
}
+
bool CXFA_FFImageEdit::CommitData() {
return true;
}
+
bool CXFA_FFImageEdit::UpdateFWLData() {
m_pDataAcc->SetImageEditImage(nullptr);
m_pDataAcc->LoadImageEditImage();
diff --git a/xfa/fxfa/app/xfa_ffnotify.cpp b/xfa/fxfa/app/xfa_ffnotify.cpp
index d9ec99aba9..475fa09eda 100644
--- a/xfa/fxfa/app/xfa_ffnotify.cpp
+++ b/xfa/fxfa/app/xfa_ffnotify.cpp
@@ -32,14 +32,31 @@
#include "xfa/fxfa/cxfa_ffwidgethandler.h"
#include "xfa/fxfa/parser/cxfa_node.h"
+namespace {
+
+CXFA_WidgetAcc* ToWidgetAcc(void* data) {
+ return static_cast<CXFA_WidgetAcc*>(data);
+}
+
+CXFA_FFListBox* ToListBox(CXFA_FFWidget* widget) {
+ return static_cast<CXFA_FFListBox*>(widget);
+}
+
+CXFA_FFComboBox* ToComboBox(CXFA_FFWidget* widget) {
+ return static_cast<CXFA_FFComboBox*>(widget);
+}
+
+} // namespace
+
static void XFA_FFDeleteWidgetAcc(void* pData) {
- delete static_cast<CXFA_WidgetAcc*>(pData);
+ delete ToWidgetAcc(pData);
}
static XFA_MAPDATABLOCKCALLBACKINFO gs_XFADeleteWidgetAcc = {
XFA_FFDeleteWidgetAcc, nullptr};
CXFA_FFNotify::CXFA_FFNotify(CXFA_FFDoc* pDoc) : m_pDoc(pDoc) {}
+
CXFA_FFNotify::~CXFA_FFNotify() {}
void CXFA_FFNotify::OnPageEvent(CXFA_ContainerLayoutItem* pSender,
@@ -53,36 +70,34 @@ void CXFA_FFNotify::OnWidgetListItemAdded(CXFA_WidgetData* pSender,
const wchar_t* pLabel,
const wchar_t* pValue,
int32_t iIndex) {
- CXFA_WidgetAcc* pWidgetAcc = static_cast<CXFA_WidgetAcc*>(pSender);
+ CXFA_WidgetAcc* pWidgetAcc = ToWidgetAcc(pSender);
if (pWidgetAcc->GetUIType() != XFA_Element::ChoiceList)
return;
CXFA_FFWidget* pWidget = nullptr;
while ((pWidget = pWidgetAcc->GetNextWidget(pWidget)) != nullptr) {
if (pWidget->IsLoaded()) {
- if (pWidgetAcc->IsListBox()) {
- static_cast<CXFA_FFListBox*>(pWidget)->InsertItem(pLabel, iIndex);
- } else {
- static_cast<CXFA_FFComboBox*>(pWidget)->InsertItem(pLabel, iIndex);
- }
+ if (pWidgetAcc->IsListBox())
+ ToListBox(pWidget)->InsertItem(pLabel, iIndex);
+ else
+ ToComboBox(pWidget)->InsertItem(pLabel, iIndex);
}
}
}
void CXFA_FFNotify::OnWidgetListItemRemoved(CXFA_WidgetData* pSender,
int32_t iIndex) {
- CXFA_WidgetAcc* pWidgetAcc = static_cast<CXFA_WidgetAcc*>(pSender);
+ CXFA_WidgetAcc* pWidgetAcc = ToWidgetAcc(pSender);
if (pWidgetAcc->GetUIType() != XFA_Element::ChoiceList)
return;
CXFA_FFWidget* pWidget = nullptr;
while ((pWidget = pWidgetAcc->GetNextWidget(pWidget)) != nullptr) {
if (pWidget->IsLoaded()) {
- if (pWidgetAcc->IsListBox()) {
- static_cast<CXFA_FFListBox*>(pWidget)->DeleteItem(iIndex);
- } else {
- static_cast<CXFA_FFComboBox*>(pWidget)->DeleteItem(iIndex);
- }
+ if (pWidgetAcc->IsListBox())
+ ToListBox(pWidget)->DeleteItem(iIndex);
+ else
+ ToComboBox(pWidget)->DeleteItem(iIndex);
}
}
}
@@ -96,7 +111,7 @@ CXFA_LayoutItem* CXFA_FFNotify::OnCreateLayoutItem(CXFA_Node* pNode) {
if (eType == XFA_Element::ContentArea)
return new CXFA_ContainerLayoutItem(pNode);
- CXFA_WidgetAcc* pAcc = static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData());
+ CXFA_WidgetAcc* pAcc = ToWidgetAcc(pNode->GetWidgetData());
if (!pAcc)
return new CXFA_ContentLayoutItem(pNode);
@@ -112,11 +127,10 @@ CXFA_LayoutItem* CXFA_FFNotify::OnCreateLayoutItem(CXFA_Node* pNode) {
pWidget = new CXFA_FFCheckButton(pAcc);
break;
case XFA_Element::ChoiceList: {
- if (pAcc->IsListBox()) {
+ if (pAcc->IsListBox())
pWidget = new CXFA_FFListBox(pAcc);
- } else {
+ else
pWidget = new CXFA_FFComboBox(pAcc);
- }
} break;
case XFA_Element::DateTimeEdit:
pWidget = new CXFA_FFDateTimeEdit(pAcc);
@@ -174,7 +188,7 @@ CXFA_LayoutItem* CXFA_FFNotify::OnCreateLayoutItem(CXFA_Node* pNode) {
void CXFA_FFNotify::StartFieldDrawLayout(CXFA_Node* pItem,
float& fCalcWidth,
float& fCalcHeight) {
- CXFA_WidgetAcc* pAcc = static_cast<CXFA_WidgetAcc*>(pItem->GetWidgetData());
+ CXFA_WidgetAcc* pAcc = ToWidgetAcc(pItem->GetWidgetData());
if (!pAcc)
return;
@@ -184,21 +198,20 @@ void CXFA_FFNotify::StartFieldDrawLayout(CXFA_Node* pItem,
bool CXFA_FFNotify::FindSplitPos(CXFA_Node* pItem,
int32_t iBlockIndex,
float& fCalcHeightPos) {
- CXFA_WidgetAcc* pAcc = static_cast<CXFA_WidgetAcc*>(pItem->GetWidgetData());
+ CXFA_WidgetAcc* pAcc = ToWidgetAcc(pItem->GetWidgetData());
return pAcc && pAcc->FindSplitPos(iBlockIndex, fCalcHeightPos);
}
bool CXFA_FFNotify::RunScript(CXFA_Node* pScript, CXFA_Node* pFormItem) {
bool bRet = false;
CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
- if (!pDocView) {
+ if (!pDocView)
return bRet;
- }
- CXFA_WidgetAcc* pWidgetAcc =
- static_cast<CXFA_WidgetAcc*>(pFormItem->GetWidgetData());
- if (!pWidgetAcc) {
+
+ CXFA_WidgetAcc* pWidgetAcc = ToWidgetAcc(pFormItem->GetWidgetData());
+ if (!pWidgetAcc)
return bRet;
- }
+
CXFA_EventParam EventParam;
EventParam.m_eType = XFA_EVENT_Unknown;
CFXJSE_Value* pRetValue = nullptr;
@@ -210,58 +223,65 @@ bool CXFA_FFNotify::RunScript(CXFA_Node* pScript, CXFA_Node* pFormItem) {
}
return bRet;
}
+
int32_t CXFA_FFNotify::ExecEventByDeepFirst(CXFA_Node* pFormNode,
XFA_EVENTTYPE eEventType,
bool bIsFormReady,
bool bRecursive,
CXFA_WidgetAcc* pExclude) {
CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
- if (!pDocView) {
+ if (!pDocView)
return XFA_EVENTERROR_NotExist;
- }
return pDocView->ExecEventActivityByDeepFirst(
pFormNode, eEventType, bIsFormReady, bRecursive,
pExclude ? pExclude->GetNode() : nullptr);
}
+
void CXFA_FFNotify::AddCalcValidate(CXFA_Node* pNode) {
CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
- if (!pDocView) {
+ if (!pDocView)
return;
- }
- CXFA_WidgetAcc* pWidgetAcc =
- static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData());
- if (!pWidgetAcc) {
+
+ CXFA_WidgetAcc* pWidgetAcc = ToWidgetAcc(pNode->GetWidgetData());
+ if (!pWidgetAcc)
return;
- }
+
pDocView->AddCalculateWidgetAcc(pWidgetAcc);
pDocView->AddValidateWidget(pWidgetAcc);
}
+
CXFA_FFDoc* CXFA_FFNotify::GetHDOC() {
return m_pDoc;
}
+
IXFA_DocEnvironment* CXFA_FFNotify::GetDocEnvironment() const {
return m_pDoc->GetDocEnvironment();
}
+
IXFA_AppProvider* CXFA_FFNotify::GetAppProvider() {
return m_pDoc->GetApp()->GetAppProvider();
}
+
CXFA_FFWidgetHandler* CXFA_FFNotify::GetWidgetHandler() {
CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
return pDocView ? pDocView->GetWidgetHandler() : nullptr;
}
+
CXFA_FFWidget* CXFA_FFNotify::GetHWidget(CXFA_LayoutItem* pLayoutItem) {
return XFA_GetWidgetFromLayoutItem(pLayoutItem);
}
+
void CXFA_FFNotify::OpenDropDownList(CXFA_FFWidget* hWidget) {
- if (hWidget->GetDataAcc()->GetUIType() != XFA_Element::ChoiceList) {
+ if (hWidget->GetDataAcc()->GetUIType() != XFA_Element::ChoiceList)
return;
- }
+
CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
pDocView->LockUpdate();
- static_cast<CXFA_FFComboBox*>(hWidget)->OpenDropDownList();
+ ToComboBox(hWidget)->OpenDropDownList();
pDocView->UnlockUpdate();
pDocView->UpdateDocView();
}
+
CFX_WideString CXFA_FFNotify::GetCurrentDateTime() {
CFX_DateTime dataTime;
dataTime.Now();
@@ -272,46 +292,51 @@ CFX_WideString CXFA_FFNotify::GetCurrentDateTime() {
dataTime.GetMinute(), dataTime.GetSecond());
return wsDateTime;
}
+
void CXFA_FFNotify::ResetData(CXFA_WidgetData* pWidgetData) {
CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
- if (!pDocView) {
+ if (!pDocView)
return;
- }
- pDocView->ResetWidgetData(static_cast<CXFA_WidgetAcc*>(pWidgetData));
+
+ pDocView->ResetWidgetData(ToWidgetAcc(pWidgetData));
}
+
int32_t CXFA_FFNotify::GetLayoutStatus() {
CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
return pDocView ? pDocView->GetLayoutStatus() : 0;
}
+
void CXFA_FFNotify::RunNodeInitialize(CXFA_Node* pNode) {
CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
- if (!pDocView) {
+ if (!pDocView)
return;
- }
+
pDocView->AddNewFormNode(pNode);
}
+
void CXFA_FFNotify::RunSubformIndexChange(CXFA_Node* pSubformNode) {
CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
- if (!pDocView) {
+ if (!pDocView)
return;
- }
+
pDocView->AddIndexChangedSubform(pSubformNode);
}
+
CXFA_Node* CXFA_FFNotify::GetFocusWidgetNode() {
CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
- if (!pDocView) {
+ if (!pDocView)
return nullptr;
- }
+
CXFA_WidgetAcc* pAcc = pDocView->GetFocusWidgetAcc();
return pAcc ? pAcc->GetNode() : nullptr;
}
+
void CXFA_FFNotify::SetFocusWidgetNode(CXFA_Node* pNode) {
CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
- if (!pDocView) {
+ if (!pDocView)
return;
- }
- CXFA_WidgetAcc* pAcc =
- pNode ? static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData()) : nullptr;
+
+ CXFA_WidgetAcc* pAcc = pNode ? ToWidgetAcc(pNode->GetWidgetData()) : nullptr;
pDocView->SetFocusWidgetAcc(pAcc);
}
@@ -330,9 +355,9 @@ void CXFA_FFNotify::OnNodeReady(CXFA_Node* pNode) {
case XFA_Element::BindItems:
pDocView->m_BindItems.push_back(pNode);
break;
- case XFA_Element::Validate: {
+ case XFA_Element::Validate:
pNode->SetFlag(XFA_NodeFlag_NeedsInitApp, false);
- } break;
+ break;
default:
break;
}
@@ -341,22 +366,18 @@ void CXFA_FFNotify::OnNodeReady(CXFA_Node* pNode) {
void CXFA_FFNotify::OnValueChanging(CXFA_Node* pSender, XFA_ATTRIBUTE eAttr) {
if (eAttr != XFA_ATTRIBUTE_Presence)
return;
-
if (pSender->GetPacketID() & XFA_XDPPACKET_Datasets)
return;
-
if (!pSender->IsFormContainer())
return;
CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
if (!pDocView)
return;
-
if (pDocView->GetLayoutStatus() < XFA_DOCVIEW_LAYOUTSTATUS_End)
return;
- CXFA_WidgetAcc* pWidgetAcc =
- static_cast<CXFA_WidgetAcc*>(pSender->GetWidgetData());
+ CXFA_WidgetAcc* pWidgetAcc = ToWidgetAcc(pSender->GetWidgetData());
if (!pWidgetAcc)
return;
@@ -383,8 +404,7 @@ void CXFA_FFNotify::OnValueChanged(CXFA_Node* pSender,
XFA_Element eType = pParentNode->GetElementType();
bool bIsContainerNode = pParentNode->IsContainerNode();
- CXFA_WidgetAcc* pWidgetAcc =
- static_cast<CXFA_WidgetAcc*>(pWidgetNode->GetWidgetData());
+ CXFA_WidgetAcc* pWidgetAcc = ToWidgetAcc(pWidgetNode->GetWidgetData());
if (!pWidgetAcc)
return;
@@ -397,7 +417,8 @@ void CXFA_FFNotify::OnValueChanged(CXFA_Node* pSender,
return;
pCapOut->Unload();
- } break;
+ break;
+ }
case XFA_Element::Ui:
case XFA_Element::Para:
bUpdateProperty = true;
@@ -422,6 +443,7 @@ void CXFA_FFNotify::OnValueChanged(CXFA_Node* pSender,
return;
}
}
+
CXFA_FFWidget* pWidget = nullptr;
while ((pWidget = pWidgetAcc->GetNextWidget(pWidget)) != nullptr) {
if (!pWidget->IsLoaded())
@@ -435,13 +457,13 @@ void CXFA_FFNotify::OnValueChanged(CXFA_Node* pSender,
}
void CXFA_FFNotify::OnChildAdded(CXFA_Node* pSender) {
- if (!pSender->IsFormContainer()) {
+ if (!pSender->IsFormContainer())
return;
- }
+
CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
- if (!pDocView) {
+ if (!pDocView)
return;
- }
+
bool bLayoutReady =
!(pDocView->m_bInLayoutStatus) &&
(pDocView->GetLayoutStatus() == XFA_DOCVIEW_LAYOUTSTATUS_End);
diff --git a/xfa/fxfa/app/xfa_ffpushbutton.cpp b/xfa/fxfa/app/xfa_ffpushbutton.cpp
index 5e9c33db14..d4b056119f 100644
--- a/xfa/fxfa/app/xfa_ffpushbutton.cpp
+++ b/xfa/fxfa/app/xfa_ffpushbutton.cpp
@@ -160,13 +160,12 @@ void CXFA_FFPushButton::LoadHighlightCaption() {
void CXFA_FFPushButton::LayoutHighlightCaption() {
CFX_SizeF sz(m_rtCaption.width, m_rtCaption.height);
LayoutCaption();
- if (m_pRolloverTextLayout) {
+ if (m_pRolloverTextLayout)
m_pRolloverTextLayout->Layout(sz);
- }
- if (m_pDownTextLayout) {
+ if (m_pDownTextLayout)
m_pDownTextLayout->Layout(sz);
- }
}
+
void CXFA_FFPushButton::RenderHighlightCaption(CFX_Graphics* pGS,
CFX_Matrix* pMatrix) {
CXFA_TextLayout* pCapTextLayout = m_pDataAcc->GetCaptionTextLayout();
@@ -221,8 +220,10 @@ void CXFA_FFPushButton::OnDrawWidget(CFX_Graphics* pGraphics,
path.AddRectangle(rtFill.left, rtFill.top, rtFill.width, rtFill.height);
pGraphics->FillPath(&path, FXFILL_WINDING, (CFX_Matrix*)pMatrix);
}
- } else if (m_pNormalWidget->GetStylesEx() &
- XFA_FWL_PSBSTYLEEXT_HiliteOutLine) {
+ return;
+ }
+
+ if (m_pNormalWidget->GetStylesEx() & XFA_FWL_PSBSTYLEEXT_HiliteOutLine) {
if ((m_pNormalWidget->GetStates() & FWL_STATE_PSB_Pressed) &&
(m_pNormalWidget->GetStates() & FWL_STATE_PSB_Hovered)) {
float fLineWidth = GetLineWidth();
diff --git a/xfa/fxfa/app/xfa_ffpushbutton.h b/xfa/fxfa/app/xfa_ffpushbutton.h
index d2f5746fe9..3695fc4e1b 100644
--- a/xfa/fxfa/app/xfa_ffpushbutton.h
+++ b/xfa/fxfa/app/xfa_ffpushbutton.h
@@ -39,7 +39,7 @@ class CXFA_FFPushButton : public CXFA_FFField {
private:
void LoadHighlightCaption();
void LayoutHighlightCaption();
- void RenderHighlightCaption(CFX_Graphics* pGS, CFX_Matrix* pMatrix = nullptr);
+ void RenderHighlightCaption(CFX_Graphics* pGS, CFX_Matrix* pMatrix);
float GetLineWidth();
FX_ARGB GetLineColor();
FX_ARGB GetFillColor();
diff --git a/xfa/fxfa/app/xfa_fftext.cpp b/xfa/fxfa/app/xfa_fftext.cpp
index 6885bfc93f..89d77c3eaf 100644
--- a/xfa/fxfa/app/xfa_fftext.cpp
+++ b/xfa/fxfa/app/xfa_fftext.cpp
@@ -72,20 +72,20 @@ bool CXFA_FFText::IsLoaded() {
CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout();
return pTextLayout && !pTextLayout->m_bHasBlock;
}
+
bool CXFA_FFText::PerformLayout() {
CXFA_FFDraw::PerformLayout();
CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout();
if (!pTextLayout)
return false;
-
if (!pTextLayout->m_bHasBlock)
return true;
pTextLayout->m_Blocks.clear();
CXFA_LayoutItem* pItem = this;
- if (!pItem->GetPrev() && !pItem->GetNext()) {
+ if (!pItem->GetPrev() && !pItem->GetNext())
return true;
- }
+
pItem = pItem->GetFirst();
while (pItem) {
CFX_RectF rtText = pItem->GetRect(false);
diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp
index 03f09cc11a..a1030f538a 100644
--- a/xfa/fxfa/app/xfa_fftextedit.cpp
+++ b/xfa/fxfa/app/xfa_fftextedit.cpp
@@ -88,11 +88,12 @@ void CXFA_FFTextEdit::UpdateWidgetProperty() {
dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly;
dwExtendedStyle |= FWL_STYLEEXT_EDT_MultiLine;
}
+
XFA_Element eType = XFA_Element::Unknown;
int32_t iMaxChars = m_pDataAcc->GetMaxChars(eType);
- if (eType == XFA_Element::ExData) {
+ if (eType == XFA_Element::ExData)
iMaxChars = 0;
- }
+
int32_t iNumCells = m_pDataAcc->GetNumberOfCells();
if (iNumCells == 0) {
dwExtendedStyle |= FWL_STYLEEXT_EDT_CombText;
@@ -166,18 +167,22 @@ bool CXFA_FFTextEdit::OnSetFocus(CXFA_FFWidget* pOldWidget) {
TranslateFWLMessage(&ms);
return true;
}
+
bool CXFA_FFTextEdit::OnKillFocus(CXFA_FFWidget* pNewWidget) {
CFWL_MessageKillFocus ms(nullptr, m_pNormalWidget.get());
TranslateFWLMessage(&ms);
m_dwStatus &= ~XFA_WidgetStatus_Focused;
+
SetEditScrollOffset();
ProcessCommittedData();
UpdateFWLData();
AddInvalidateRect();
CXFA_FFWidget::OnKillFocus(pNewWidget);
+
m_dwStatus &= ~XFA_WidgetStatus_TextEditValueChanged;
return true;
}
+
bool CXFA_FFTextEdit::CommitData() {
CFX_WideString wsText =
static_cast<CFWL_Edit*>(m_pNormalWidget.get())->GetText();
@@ -188,84 +193,90 @@ bool CXFA_FFTextEdit::CommitData() {
ValidateNumberField(wsText);
return false;
}
+
void CXFA_FFTextEdit::ValidateNumberField(const CFX_WideString& wsText) {
CXFA_WidgetAcc* pAcc = GetDataAcc();
- if (pAcc && pAcc->GetUIType() == XFA_Element::NumericEdit) {
- IXFA_AppProvider* pAppProvider = GetApp()->GetAppProvider();
- if (pAppProvider) {
- CFX_WideString wsSomField;
- pAcc->GetNode()->GetSOMExpression(wsSomField);
-
- CFX_WideString wsMessage;
- wsMessage.Format(L"%s can not contain %s", wsText.c_str(),
- wsSomField.c_str());
- pAppProvider->MsgBox(wsMessage, pAppProvider->GetAppTitle(),
- XFA_MBICON_Error, XFA_MB_OK);
- }
- }
+ if (!pAcc || pAcc->GetUIType() != XFA_Element::NumericEdit)
+ return;
+
+ IXFA_AppProvider* pAppProvider = GetApp()->GetAppProvider();
+ if (!pAppProvider)
+ return;
+
+ CFX_WideString wsSomField;
+ pAcc->GetNode()->GetSOMExpression(wsSomField);
+
+ CFX_WideString wsMessage;
+ wsMessage.Format(L"%s can not contain %s", wsText.c_str(),
+ wsSomField.c_str());
+ pAppProvider->MsgBox(wsMessage, pAppProvider->GetAppTitle(), XFA_MBICON_Error,
+ XFA_MB_OK);
}
+
bool CXFA_FFTextEdit::IsDataChanged() {
return (m_dwStatus & XFA_WidgetStatus_TextEditValueChanged) != 0;
}
+
uint32_t CXFA_FFTextEdit::GetAlignment() {
+ CXFA_Para para = m_pDataAcc->GetPara();
+ if (!para)
+ return 0;
+
uint32_t dwExtendedStyle = 0;
- if (CXFA_Para para = m_pDataAcc->GetPara()) {
- int32_t iHorz = para.GetHorizontalAlign();
- switch (iHorz) {
- case XFA_ATTRIBUTEENUM_Center:
- dwExtendedStyle |= FWL_STYLEEXT_EDT_HCenter;
- break;
- case XFA_ATTRIBUTEENUM_Justify:
- dwExtendedStyle |= FWL_STYLEEXT_EDT_Justified;
- break;
- case XFA_ATTRIBUTEENUM_JustifyAll:
- break;
- case XFA_ATTRIBUTEENUM_Radix:
- break;
- case XFA_ATTRIBUTEENUM_Right:
- dwExtendedStyle |= FWL_STYLEEXT_EDT_HFar;
- break;
- default:
- dwExtendedStyle |= FWL_STYLEEXT_EDT_HNear;
- break;
- }
- int32_t iVert = para.GetVerticalAlign();
- switch (iVert) {
- case XFA_ATTRIBUTEENUM_Middle:
- dwExtendedStyle |= FWL_STYLEEXT_EDT_VCenter;
- break;
- case XFA_ATTRIBUTEENUM_Bottom:
- dwExtendedStyle |= FWL_STYLEEXT_EDT_VFar;
- break;
- default:
- dwExtendedStyle |= FWL_STYLEEXT_EDT_VNear;
- break;
- }
+ switch (para.GetHorizontalAlign()) {
+ case XFA_ATTRIBUTEENUM_Center:
+ dwExtendedStyle |= FWL_STYLEEXT_EDT_HCenter;
+ break;
+ case XFA_ATTRIBUTEENUM_Justify:
+ dwExtendedStyle |= FWL_STYLEEXT_EDT_Justified;
+ break;
+ case XFA_ATTRIBUTEENUM_JustifyAll:
+ case XFA_ATTRIBUTEENUM_Radix:
+ break;
+ case XFA_ATTRIBUTEENUM_Right:
+ dwExtendedStyle |= FWL_STYLEEXT_EDT_HFar;
+ break;
+ default:
+ dwExtendedStyle |= FWL_STYLEEXT_EDT_HNear;
+ break;
+ }
+
+ switch (para.GetVerticalAlign()) {
+ case XFA_ATTRIBUTEENUM_Middle:
+ dwExtendedStyle |= FWL_STYLEEXT_EDT_VCenter;
+ break;
+ case XFA_ATTRIBUTEENUM_Bottom:
+ dwExtendedStyle |= FWL_STYLEEXT_EDT_VFar;
+ break;
+ default:
+ dwExtendedStyle |= FWL_STYLEEXT_EDT_VNear;
+ break;
}
return dwExtendedStyle;
}
+
bool CXFA_FFTextEdit::UpdateFWLData() {
- if (!m_pNormalWidget) {
+ if (!m_pNormalWidget)
return false;
- }
+
XFA_VALUEPICTURE eType = XFA_VALUEPICTURE_Display;
- if (IsFocused()) {
+ if (IsFocused())
eType = XFA_VALUEPICTURE_Edit;
- }
+
bool bUpdate = false;
if (m_pDataAcc->GetUIType() == XFA_Element::TextEdit &&
m_pDataAcc->GetNumberOfCells() < 0) {
XFA_Element elementType = XFA_Element::Unknown;
int32_t iMaxChars = m_pDataAcc->GetMaxChars(elementType);
- if (elementType == XFA_Element::ExData) {
+ if (elementType == XFA_Element::ExData)
iMaxChars = eType == XFA_VALUEPICTURE_Edit ? iMaxChars : 0;
- }
if (static_cast<CFWL_Edit*>(m_pNormalWidget.get())->GetLimit() !=
iMaxChars) {
static_cast<CFWL_Edit*>(m_pNormalWidget.get())->SetLimit(iMaxChars);
bUpdate = true;
}
}
+
if (m_pDataAcc->GetUIType() == XFA_Element::Barcode) {
int32_t nDataLen = 0;
if (eType == XFA_VALUEPICTURE_Edit)
@@ -273,19 +284,22 @@ bool CXFA_FFTextEdit::UpdateFWLData() {
static_cast<CFWL_Edit*>(m_pNormalWidget.get())->SetLimit(nDataLen);
bUpdate = true;
}
+
CFX_WideString wsText;
m_pDataAcc->GetValue(wsText, eType);
+
CFX_WideString wsOldText =
static_cast<CFWL_Edit*>(m_pNormalWidget.get())->GetText();
if (wsText != wsOldText || (eType == XFA_VALUEPICTURE_Edit && bUpdate)) {
static_cast<CFWL_Edit*>(m_pNormalWidget.get())->SetText(wsText);
bUpdate = true;
}
- if (bUpdate) {
+ if (bUpdate)
m_pNormalWidget->Update();
- }
+
return true;
}
+
void CXFA_FFTextEdit::OnTextChanged(CFWL_Widget* pWidget,
const CFX_WideString& wsChanged,
const CFX_WideString& wsPrevText) {
@@ -300,18 +314,17 @@ void CXFA_FFTextEdit::OnTextChanged(CFWL_Widget* pWidget,
CFWL_DateTimePicker* pDateTime = (CFWL_DateTimePicker*)pEdit;
eParam.m_wsNewText = pDateTime->GetEditText();
int32_t iSels = pDateTime->CountSelRanges();
- if (iSels) {
+ if (iSels)
eParam.m_iSelEnd = pDateTime->GetSelRange(0, &eParam.m_iSelStart);
- }
} else {
eParam.m_wsNewText = pEdit->GetText();
int32_t iSels = pEdit->CountSelRanges();
- if (iSels) {
+ if (iSels)
eParam.m_iSelEnd = pEdit->GetSelRange(0, &eParam.m_iSelStart);
- }
}
m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam);
}
+
void CXFA_FFTextEdit::OnTextFull(CFWL_Widget* pWidget) {
CXFA_EventParam eParam;
eParam.m_eType = XFA_EVENT_Full;
@@ -387,6 +400,7 @@ bool CXFA_FFNumericEdit::LoadWidget() {
m_pNormalWidget->UnlockUpdate();
return CXFA_FFField::LoadWidget();
}
+
void CXFA_FFNumericEdit::UpdateWidgetProperty() {
CFWL_Edit* pWidget = static_cast<CFWL_Edit*>(m_pNormalWidget.get());
if (!pWidget)
@@ -426,13 +440,15 @@ bool CXFA_FFNumericEdit::OnValidate(CFWL_Widget* pWidget,
CFX_WideString& wsText) {
CFX_WideString wsPattern;
m_pDataAcc->GetPictureContent(wsPattern, XFA_VALUEPICTURE_Edit);
- if (!wsPattern.IsEmpty()) {
+ if (!wsPattern.IsEmpty())
return true;
- }
+
int32_t iLeads = 0;
m_pDataAcc->GetLeadDigits(iLeads);
+
int32_t iFracs = 0;
m_pDataAcc->GetFracDigits(iFracs);
+
CFX_WideString wsFormat;
CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(m_pDataAcc);
widgetValue.GetNumbericFormat(wsFormat, iLeads, iFracs);
@@ -477,14 +493,13 @@ void CXFA_FFPasswordEdit::UpdateWidgetProperty() {
FWL_STYLEEXT_EDT_ShowScrollbarFocus | FWL_STYLEEXT_EDT_OuterScrollbar |
FWL_STYLEEXT_EDT_Password | FWL_STYLEEXT_EDT_LastLineHeight;
dwExtendedStyle |= UpdateUIProperty();
+
CFX_WideString wsPassWord;
m_pDataAcc->GetPasswordChar(wsPassWord);
- if (!wsPassWord.IsEmpty()) {
+ if (!wsPassWord.IsEmpty())
pWidget->SetAliasChar(wsPassWord.GetAt(0));
- }
- if (m_pDataAcc->GetHorizontalScrollPolicy() != XFA_ATTRIBUTEENUM_Off) {
+ if (m_pDataAcc->GetHorizontalScrollPolicy() != XFA_ATTRIBUTEENUM_Off)
dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoHScroll;
- }
if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open ||
!m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) {
dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly;
@@ -492,6 +507,7 @@ void CXFA_FFPasswordEdit::UpdateWidgetProperty() {
dwExtendedStyle |= GetAlignment();
m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF);
}
+
CXFA_FFDateTimeEdit::CXFA_FFDateTimeEdit(CXFA_WidgetAcc* pDataAcc)
: CXFA_FFTextEdit(pDataAcc) {}
@@ -543,6 +559,7 @@ bool CXFA_FFDateTimeEdit::LoadWidget() {
m_pNormalWidget->UnlockUpdate();
return CXFA_FFField::LoadWidget();
}
+
void CXFA_FFDateTimeEdit::UpdateWidgetProperty() {
CFWL_DateTimePicker* pWidget =
static_cast<CFWL_DateTimePicker*>(m_pNormalWidget.get());
@@ -563,45 +580,46 @@ void CXFA_FFDateTimeEdit::UpdateWidgetProperty() {
!m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) {
dwEditStyles |= FWL_STYLEEXT_EDT_ReadOnly;
}
- if (m_pDataAcc->GetHorizontalScrollPolicy() != XFA_ATTRIBUTEENUM_Off) {
+ if (m_pDataAcc->GetHorizontalScrollPolicy() != XFA_ATTRIBUTEENUM_Off)
dwEditStyles |= FWL_STYLEEXT_EDT_AutoHScroll;
- }
+
pWidget->ModifyEditStylesEx(dwEditStyles, 0xFFFFFFFF);
}
+
uint32_t CXFA_FFDateTimeEdit::GetAlignment() {
+ CXFA_Para para = m_pDataAcc->GetPara();
+ if (!para)
+ return 0;
+
uint32_t dwExtendedStyle = 0;
- if (CXFA_Para para = m_pDataAcc->GetPara()) {
- int32_t iHorz = para.GetHorizontalAlign();
- switch (iHorz) {
- case XFA_ATTRIBUTEENUM_Center:
- dwExtendedStyle |= FWL_STYLEEXT_DTP_EditHCenter;
- break;
- case XFA_ATTRIBUTEENUM_Justify:
- dwExtendedStyle |= FWL_STYLEEXT_DTP_EditJustified;
- break;
- case XFA_ATTRIBUTEENUM_JustifyAll:
- break;
- case XFA_ATTRIBUTEENUM_Radix:
- break;
- case XFA_ATTRIBUTEENUM_Right:
- dwExtendedStyle |= FWL_STYLEEXT_DTP_EditHFar;
- break;
- default:
- dwExtendedStyle |= FWL_STYLEEXT_DTP_EditHNear;
- break;
- }
- int32_t iVert = para.GetVerticalAlign();
- switch (iVert) {
- case XFA_ATTRIBUTEENUM_Middle:
- dwExtendedStyle |= FWL_STYLEEXT_DTP_EditVCenter;
- break;
- case XFA_ATTRIBUTEENUM_Bottom:
- dwExtendedStyle |= FWL_STYLEEXT_DTP_EditVFar;
- break;
- default:
- dwExtendedStyle |= FWL_STYLEEXT_DTP_EditVNear;
- break;
- }
+ switch (para.GetHorizontalAlign()) {
+ case XFA_ATTRIBUTEENUM_Center:
+ dwExtendedStyle |= FWL_STYLEEXT_DTP_EditHCenter;
+ break;
+ case XFA_ATTRIBUTEENUM_Justify:
+ dwExtendedStyle |= FWL_STYLEEXT_DTP_EditJustified;
+ break;
+ case XFA_ATTRIBUTEENUM_JustifyAll:
+ case XFA_ATTRIBUTEENUM_Radix:
+ break;
+ case XFA_ATTRIBUTEENUM_Right:
+ dwExtendedStyle |= FWL_STYLEEXT_DTP_EditHFar;
+ break;
+ default:
+ dwExtendedStyle |= FWL_STYLEEXT_DTP_EditHNear;
+ break;
+ }
+
+ switch (para.GetVerticalAlign()) {
+ case XFA_ATTRIBUTEENUM_Middle:
+ dwExtendedStyle |= FWL_STYLEEXT_DTP_EditVCenter;
+ break;
+ case XFA_ATTRIBUTEENUM_Bottom:
+ dwExtendedStyle |= FWL_STYLEEXT_DTP_EditVFar;
+ break;
+ default:
+ dwExtendedStyle |= FWL_STYLEEXT_DTP_EditVNear;
+ break;
}
return dwExtendedStyle;
}
@@ -616,33 +634,34 @@ bool CXFA_FFDateTimeEdit::CommitData() {
}
bool CXFA_FFDateTimeEdit::UpdateFWLData() {
- if (!m_pNormalWidget) {
+ if (!m_pNormalWidget)
return false;
- }
+
XFA_VALUEPICTURE eType = XFA_VALUEPICTURE_Display;
- if (IsFocused()) {
+ if (IsFocused())
eType = XFA_VALUEPICTURE_Edit;
- }
+
CFX_WideString wsText;
m_pDataAcc->GetValue(wsText, eType);
- static_cast<CFWL_DateTimePicker*>(m_pNormalWidget.get())->SetEditText(wsText);
+
+ auto* normalWidget = static_cast<CFWL_DateTimePicker*>(m_pNormalWidget.get());
+ normalWidget->SetEditText(wsText);
if (IsFocused() && !wsText.IsEmpty()) {
CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc);
CFX_DateTime date = lcValue.GetDate();
if (lcValue.IsValid()) {
- if (date.IsSet()) {
- static_cast<CFWL_DateTimePicker*>(m_pNormalWidget.get())
- ->SetCurSel(date.GetYear(), date.GetMonth(), date.GetDay());
- }
+ if (date.IsSet())
+ normalWidget->SetCurSel(date.GetYear(), date.GetMonth(), date.GetDay());
}
}
m_pNormalWidget->Update();
return true;
}
+
bool CXFA_FFDateTimeEdit::IsDataChanged() {
- if (m_dwStatus & XFA_WidgetStatus_TextEditValueChanged) {
+ if (m_dwStatus & XFA_WidgetStatus_TextEditValueChanged)
return true;
- }
+
CFX_WideString wsText =
static_cast<CFWL_DateTimePicker*>(m_pNormalWidget.get())->GetEditText();
CFX_WideString wsOldValue;
diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp
index 7f53027e5c..218537618f 100644
--- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp
+++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp
@@ -35,33 +35,24 @@
CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) {
bRichText = false;
- if (m_pTextNode) {
- if (m_pTextNode->GetElementType() == XFA_Element::ExData) {
- CFX_WideString wsContentType;
- m_pTextNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType,
- false);
- if (wsContentType == L"text/html") {
- bRichText = true;
- }
- }
- return m_pTextNode;
- }
+
if (m_eType == XFA_TEXTPROVIDERTYPE_Text) {
CXFA_Node* pElementNode = m_pWidgetAcc->GetNode();
CXFA_Node* pValueNode = pElementNode->GetChild(0, XFA_Element::Value);
- if (!pValueNode) {
+ if (!pValueNode)
return nullptr;
- }
+
CXFA_Node* pChildNode = pValueNode->GetNodeItem(XFA_NODEITEM_FirstChild);
if (pChildNode && pChildNode->GetElementType() == XFA_Element::ExData) {
CFX_WideString wsContentType;
pChildNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, false);
- if (wsContentType == L"text/html") {
+ if (wsContentType == L"text/html")
bRichText = true;
- }
}
return pChildNode;
- } else if (m_eType == XFA_TEXTPROVIDERTYPE_Datasets) {
+ }
+
+ if (m_eType == XFA_TEXTPROVIDERTYPE_Datasets) {
CXFA_Node* pBind = m_pWidgetAcc->GetDatasets();
CFX_XMLNode* pXMLNode = pBind->GetXMLMappingNode();
ASSERT(pXMLNode);
@@ -71,105 +62,106 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) {
pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) {
if (pXMLChild->GetType() == FX_XMLNODE_Element) {
CFX_XMLElement* pElement = static_cast<CFX_XMLElement*>(pXMLChild);
- if (XFA_RecognizeRichText(pElement)) {
+ if (XFA_RecognizeRichText(pElement))
bRichText = true;
- }
}
}
return pBind;
- } else if (m_eType == XFA_TEXTPROVIDERTYPE_Caption) {
+ }
+
+ if (m_eType == XFA_TEXTPROVIDERTYPE_Caption) {
CXFA_Node* pCaptionNode =
m_pWidgetAcc->GetNode()->GetChild(0, XFA_Element::Caption);
- if (!pCaptionNode) {
+ if (!pCaptionNode)
return nullptr;
- }
+
CXFA_Node* pValueNode = pCaptionNode->GetChild(0, XFA_Element::Value);
- if (!pValueNode) {
+ if (!pValueNode)
return nullptr;
- }
+
CXFA_Node* pChildNode = pValueNode->GetNodeItem(XFA_NODEITEM_FirstChild);
if (pChildNode && pChildNode->GetElementType() == XFA_Element::ExData) {
CFX_WideString wsContentType;
pChildNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, false);
- if (wsContentType == L"text/html") {
+ if (wsContentType == L"text/html")
bRichText = true;
- }
}
return pChildNode;
}
+
CXFA_Node* pItemNode =
m_pWidgetAcc->GetNode()->GetChild(0, XFA_Element::Items);
- if (!pItemNode) {
+ if (!pItemNode)
return nullptr;
- }
+
CXFA_Node* pNode = pItemNode->GetNodeItem(XFA_NODEITEM_FirstChild);
while (pNode) {
CFX_WideStringC wsName;
pNode->TryCData(XFA_ATTRIBUTE_Name, wsName);
- if (m_eType == XFA_TEXTPROVIDERTYPE_Rollover && wsName == L"rollover") {
+ if (m_eType == XFA_TEXTPROVIDERTYPE_Rollover && wsName == L"rollover")
return pNode;
- }
- if (m_eType == XFA_TEXTPROVIDERTYPE_Down && wsName == L"down") {
+ if (m_eType == XFA_TEXTPROVIDERTYPE_Down && wsName == L"down")
return pNode;
- }
+
pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling);
}
return nullptr;
}
+
CXFA_Para CXFA_TextProvider::GetParaNode() {
- if (m_eType == XFA_TEXTPROVIDERTYPE_Text) {
+ if (m_eType == XFA_TEXTPROVIDERTYPE_Text)
return m_pWidgetAcc->GetPara();
- }
+
CXFA_Node* pNode = m_pWidgetAcc->GetNode()->GetChild(0, XFA_Element::Caption);
return CXFA_Para(pNode->GetChild(0, XFA_Element::Para));
}
+
CXFA_Font CXFA_TextProvider::GetFontNode() {
- if (m_eType == XFA_TEXTPROVIDERTYPE_Text) {
+ if (m_eType == XFA_TEXTPROVIDERTYPE_Text)
return m_pWidgetAcc->GetFont();
- }
+
CXFA_Node* pNode = m_pWidgetAcc->GetNode()->GetChild(0, XFA_Element::Caption);
pNode = pNode->GetChild(0, XFA_Element::Font);
- if (pNode) {
- return CXFA_Font(pNode);
- }
- return m_pWidgetAcc->GetFont();
+ return pNode ? CXFA_Font(pNode) : m_pWidgetAcc->GetFont();
}
+
bool CXFA_TextProvider::IsCheckButtonAndAutoWidth() {
XFA_Element eType = m_pWidgetAcc->GetUIType();
- if (eType == XFA_Element::CheckButton) {
- float fWidth = 0;
- return !m_pWidgetAcc->GetWidth(fWidth);
- }
- return false;
+ if (eType != XFA_Element::CheckButton)
+ return false;
+
+ float fWidth = 0;
+ return !m_pWidgetAcc->GetWidth(fWidth);
}
+
bool CXFA_TextProvider::GetEmbbedObj(bool bURI,
bool bRaw,
const CFX_WideString& wsAttr,
CFX_WideString& wsValue) {
- if (m_eType != XFA_TEXTPROVIDERTYPE_Text) {
+ if (m_eType != XFA_TEXTPROVIDERTYPE_Text)
return false;
+
+ if (!bURI)
+ return false;
+
+ CXFA_Node* pWidgetNode = m_pWidgetAcc->GetNode();
+ CXFA_Node* pParent = pWidgetNode->GetNodeItem(XFA_NODEITEM_Parent);
+ CXFA_Document* pDocument = pWidgetNode->GetDocument();
+ CXFA_Node* pIDNode = nullptr;
+ CXFA_WidgetAcc* pEmbAcc = nullptr;
+ if (pParent)
+ pIDNode = pDocument->GetNodeByID(pParent, wsAttr.AsStringC());
+
+ if (!pIDNode) {
+ pIDNode = pDocument->GetNodeByID(
+ ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Form)), wsAttr.AsStringC());
}
- if (bURI) {
- CXFA_Node* pWidgetNode = m_pWidgetAcc->GetNode();
- CXFA_Node* pParent = pWidgetNode->GetNodeItem(XFA_NODEITEM_Parent);
- CXFA_Document* pDocument = pWidgetNode->GetDocument();
- CXFA_Node* pIDNode = nullptr;
- CXFA_WidgetAcc* pEmbAcc = nullptr;
- if (pParent) {
- pIDNode = pDocument->GetNodeByID(pParent, wsAttr.AsStringC());
- }
- if (!pIDNode) {
- pIDNode = pDocument->GetNodeByID(
- ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Form)),
- wsAttr.AsStringC());
- }
- if (pIDNode) {
- pEmbAcc = static_cast<CXFA_WidgetAcc*>(pIDNode->GetWidgetData());
- }
- if (pEmbAcc) {
- pEmbAcc->GetValue(wsValue, XFA_VALUEPICTURE_Display);
- return true;
- }
- }
- return false;
+ if (pIDNode)
+ pEmbAcc = static_cast<CXFA_WidgetAcc*>(pIDNode->GetWidgetData());
+
+ if (!pEmbAcc)
+ return false;
+
+ pEmbAcc->GetValue(wsValue, XFA_VALUEPICTURE_Display);
+ return true;
}
diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.h b/xfa/fxfa/app/xfa_ffwidgetacc.h
index c4988fde66..7840186b14 100644
--- a/xfa/fxfa/app/xfa_ffwidgetacc.h
+++ b/xfa/fxfa/app/xfa_ffwidgetacc.h
@@ -26,10 +26,8 @@ enum XFA_TEXTPROVIDERTYPE {
class CXFA_TextProvider {
public:
- CXFA_TextProvider(CXFA_WidgetAcc* pWidgetAcc,
- XFA_TEXTPROVIDERTYPE eType,
- CXFA_Node* pTextNode = nullptr)
- : m_pWidgetAcc(pWidgetAcc), m_eType(eType), m_pTextNode(pTextNode) {
+ CXFA_TextProvider(CXFA_WidgetAcc* pWidgetAcc, XFA_TEXTPROVIDERTYPE eType)
+ : m_pWidgetAcc(pWidgetAcc), m_eType(eType) {
ASSERT(m_pWidgetAcc);
}
~CXFA_TextProvider() {}
@@ -47,7 +45,6 @@ class CXFA_TextProvider {
private:
CXFA_WidgetAcc* m_pWidgetAcc;
XFA_TEXTPROVIDERTYPE m_eType;
- CXFA_Node* m_pTextNode;
};
#endif // XFA_FXFA_APP_XFA_FFWIDGETACC_H_