diff options
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/fxfa/cxfa_ffarc.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffcheckbutton.cpp | 10 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffcombobox.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffdatetimeedit.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffdocview.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_fffield.cpp | 16 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffimage.cpp | 6 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffimageedit.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffline.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_fflistbox.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffpageview.cpp | 3 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffpushbutton.cpp | 10 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffrectangle.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_fftext.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_fftextedit.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffwidget.cpp | 6 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffwidgethandler.cpp | 6 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_fwltheme.cpp | 19 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_textprovider.cpp | 8 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_widgetacc.cpp | 246 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_widgetacc.h | 26 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_node.cpp | 127 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_node.h | 31 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_utils.cpp | 2 |
24 files changed, 281 insertions, 269 deletions
diff --git a/xfa/fxfa/cxfa_ffarc.cpp b/xfa/fxfa/cxfa_ffarc.cpp index 95a64e7c61..34bac00702 100644 --- a/xfa/fxfa/cxfa_ffarc.cpp +++ b/xfa/fxfa/cxfa_ffarc.cpp @@ -19,12 +19,12 @@ void CXFA_FFArc::RenderWidget(CXFA_Graphics* pGS, if (!IsMatchVisibleStatus(dwStatus)) return; - CXFA_Value* value = m_pDataAcc->GetFormValue(); + CXFA_Value* value = m_pDataAcc->GetNode()->GetFormValue(); if (!value) return; CFX_RectF rtArc = GetRectWithoutRotate(); - CXFA_Margin* margin = m_pDataAcc->GetMargin(); + CXFA_Margin* margin = m_pDataAcc->GetNode()->GetMargin(); if (margin) XFA_RectWidthoutMargin(rtArc, margin); diff --git a/xfa/fxfa/cxfa_ffcheckbutton.cpp b/xfa/fxfa/cxfa_ffcheckbutton.cpp index e7f8e27bc0..8d4a235cfb 100644 --- a/xfa/fxfa/cxfa_ffcheckbutton.cpp +++ b/xfa/fxfa/cxfa_ffcheckbutton.cpp @@ -91,14 +91,14 @@ bool CXFA_FFCheckButton::PerformLayout() { CXFA_FFWidget::PerformLayout(); float fCheckSize = m_pDataAcc->GetCheckButtonSize(); - CXFA_Margin* margin = m_pDataAcc->GetMargin(); + CXFA_Margin* margin = m_pDataAcc->GetNode()->GetMargin(); CFX_RectF rtWidget = GetRectWithoutRotate(); if (margin) XFA_RectWidthoutMargin(rtWidget, margin); XFA_AttributeEnum iCapPlacement = XFA_AttributeEnum::Unknown; float fCapReserve = 0; - CXFA_Caption* caption = m_pDataAcc->GetCaption(); + CXFA_Caption* caption = m_pDataAcc->GetNode()->GetCaption(); if (caption && caption->IsVisible()) { m_rtCaption = rtWidget; iCapPlacement = caption->GetPlacementType(); @@ -115,7 +115,7 @@ bool CXFA_FFCheckButton::PerformLayout() { XFA_AttributeEnum iHorzAlign = XFA_AttributeEnum::Left; XFA_AttributeEnum iVertAlign = XFA_AttributeEnum::Top; - CXFA_Para* para = m_pDataAcc->GetPara(); + CXFA_Para* para = m_pDataAcc->GetNode()->GetPara(); if (para) { iHorzAlign = para->GetHorizontalAlign(); iVertAlign = para->GetVerticalAlign(); @@ -309,7 +309,9 @@ void CXFA_FFCheckButton::OnProcessEvent(CFWL_Event* pEvent) { eParam.m_eType = XFA_EVENT_Change; eParam.m_wsNewText = m_pDataAcc->GetValue(XFA_VALUEPICTURE_Raw); - CXFA_WidgetAcc* pFFExclGroup = m_pDataAcc->GetExclGroup(); + CXFA_Node* exclNode = m_pDataAcc->GetNode()->GetExclGroup(); + CXFA_WidgetAcc* pFFExclGroup = + exclNode ? exclNode->GetWidgetAcc() : nullptr; if (ProcessCommittedData()) { eParam.m_pTarget = pFFExclGroup; if (pFFExclGroup) { diff --git a/xfa/fxfa/cxfa_ffcombobox.cpp b/xfa/fxfa/cxfa_ffcombobox.cpp index 13bda7adbb..729dae58fb 100644 --- a/xfa/fxfa/cxfa_ffcombobox.cpp +++ b/xfa/fxfa/cxfa_ffcombobox.cpp @@ -139,7 +139,7 @@ void CXFA_FFComboBox::FWLEventSelChange(CXFA_EventParam* pParam) { } uint32_t CXFA_FFComboBox::GetAlignment() { - CXFA_Para* para = m_pDataAcc->GetPara(); + CXFA_Para* para = m_pDataAcc->GetNode()->GetPara(); if (!para) return 0; diff --git a/xfa/fxfa/cxfa_ffdatetimeedit.cpp b/xfa/fxfa/cxfa_ffdatetimeedit.cpp index d4f925c179..aa2746e730 100644 --- a/xfa/fxfa/cxfa_ffdatetimeedit.cpp +++ b/xfa/fxfa/cxfa_ffdatetimeedit.cpp @@ -52,7 +52,7 @@ bool CXFA_FFDateTimeEdit::LoadWidget() { WideString wsText = m_pDataAcc->GetValue(XFA_VALUEPICTURE_Display); pWidget->SetEditText(wsText); - CXFA_Value* value = m_pDataAcc->GetFormValue(); + CXFA_Value* value = m_pDataAcc->GetNode()->GetFormValue(); if (value) { switch (value->GetChildValueClassID()) { case XFA_Element::Date: { @@ -98,7 +98,7 @@ void CXFA_FFDateTimeEdit::UpdateWidgetProperty() { } uint32_t CXFA_FFDateTimeEdit::GetAlignment() { - CXFA_Para* para = m_pDataAcc->GetPara(); + CXFA_Para* para = m_pDataAcc->GetNode()->GetPara(); if (!para) return 0; diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp index 011e3bf8a0..75397bfc2b 100644 --- a/xfa/fxfa/cxfa_ffdocview.cpp +++ b/xfa/fxfa/cxfa_ffdocview.cpp @@ -228,7 +228,7 @@ bool CXFA_FFDocView::ResetSingleWidgetAccData(CXFA_WidgetAcc* pWidgetAcc) { pWidgetAcc->ResetData(); pWidgetAcc->UpdateUIDisplay(this, nullptr); - CXFA_Validate* validate = pWidgetAcc->GetValidate(false); + CXFA_Validate* validate = pNode->GetValidate(false); if (!validate) return true; @@ -424,7 +424,7 @@ static int32_t XFA_ProcessEvent(CXFA_FFDocView* pDocView, } return XFA_EVENTERROR_Disabled; case XFA_EVENT_InitCalculate: { - CXFA_Calculate* calc = pWidgetAcc->GetCalculate(); + CXFA_Calculate* calc = pWidgetAcc->GetNode()->GetCalculate(); if (!calc) return XFA_EVENTERROR_NotExist; if (pWidgetAcc->GetNode()->IsUserInteractive()) diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp index 4fd0a39276..80752459e2 100644 --- a/xfa/fxfa/cxfa_fffield.cpp +++ b/xfa/fxfa/cxfa_fffield.cpp @@ -171,7 +171,7 @@ bool CXFA_FFField::PerformLayout() { void CXFA_FFField::CapPlacement() { CFX_RectF rtWidget = GetRectWithoutRotate(); - CXFA_Margin* margin = m_pDataAcc->GetMargin(); + CXFA_Margin* margin = m_pDataAcc->GetNode()->GetMargin(); if (margin) { CXFA_LayoutItem* pItem = this; float fLeftInset = margin->GetLeftInset(); @@ -192,7 +192,7 @@ void CXFA_FFField::CapPlacement() { XFA_AttributeEnum iCapPlacement = XFA_AttributeEnum::Unknown; float fCapReserve = 0; - CXFA_Caption* caption = m_pDataAcc->GetCaption(); + CXFA_Caption* caption = m_pDataAcc->GetNode()->GetCaption(); if (caption && !caption->IsHidden()) { iCapPlacement = caption->GetPlacementType(); if (iCapPlacement == XFA_AttributeEnum::Top && GetPrev()) { @@ -349,7 +349,7 @@ void CXFA_FFField::SetFWLRect() { if (rtUi.width < 1.0) rtUi.width = 1.0; if (!GetDoc()->GetXFADoc()->IsInteractive()) { - float fFontSize = m_pDataAcc->GetFontSize(); + float fFontSize = m_pDataAcc->GetNode()->GetFontSize(); if (rtUi.height < fFontSize) rtUi.height = fFontSize; } @@ -599,7 +599,7 @@ void CXFA_FFField::RenderCaption(CXFA_Graphics* pGS, CFX_Matrix* pMatrix) { if (!pCapTextLayout) return; - CXFA_Caption* caption = m_pDataAcc->GetCaption(); + CXFA_Caption* caption = m_pDataAcc->GetNode()->GetCaption(); if (!caption || !caption->IsVisible()) return; @@ -633,7 +633,11 @@ bool CXFA_FFField::ProcessCommittedData() { } int32_t CXFA_FFField::CalculateOverride() { - CXFA_WidgetAcc* pAcc = m_pDataAcc->GetExclGroup(); + CXFA_Node* exclNode = m_pDataAcc->GetNode()->GetExclGroup(); + if (!exclNode) + return CalculateWidgetAcc(m_pDataAcc.Get()); + + CXFA_WidgetAcc* pAcc = exclNode->GetWidgetAcc(); if (!pAcc) return CalculateWidgetAcc(m_pDataAcc.Get()); if (CalculateWidgetAcc(pAcc) == 0) @@ -657,7 +661,7 @@ int32_t CXFA_FFField::CalculateOverride() { } int32_t CXFA_FFField::CalculateWidgetAcc(CXFA_WidgetAcc* pAcc) { - CXFA_Calculate* calc = pAcc->GetCalculate(); + CXFA_Calculate* calc = pAcc->GetNode()->GetCalculate(); if (!calc) return 1; diff --git a/xfa/fxfa/cxfa_ffimage.cpp b/xfa/fxfa/cxfa_ffimage.cpp index 2f75264cb2..dbd0067ec9 100644 --- a/xfa/fxfa/cxfa_ffimage.cpp +++ b/xfa/fxfa/cxfa_ffimage.cpp @@ -53,13 +53,13 @@ void CXFA_FFImage::RenderWidget(CXFA_Graphics* pGS, return; CFX_RectF rtImage = GetRectWithoutRotate(); - CXFA_Margin* margin = m_pDataAcc->GetMargin(); + CXFA_Margin* margin = m_pDataAcc->GetNode()->GetMargin(); if (margin) XFA_RectWidthoutMargin(rtImage, margin); XFA_AttributeEnum iHorzAlign = XFA_AttributeEnum::Left; XFA_AttributeEnum iVertAlign = XFA_AttributeEnum::Top; - CXFA_Para* para = m_pDataAcc->GetPara(); + CXFA_Para* para = m_pDataAcc->GetNode()->GetPara(); if (para) { iHorzAlign = para->GetHorizontalAlign(); iVertAlign = para->GetVerticalAlign(); @@ -68,7 +68,7 @@ void CXFA_FFImage::RenderWidget(CXFA_Graphics* pGS, int32_t iImageXDpi = 0; int32_t iImageYDpi = 0; m_pDataAcc->GetImageDpi(iImageXDpi, iImageYDpi); - auto* value = m_pDataAcc->GetFormValue(); + auto* value = m_pDataAcc->GetNode()->GetFormValue(); CXFA_Image* image = value ? value->GetImage() : nullptr; XFA_DrawImage(pGS, rtImage, mtRotate, pDIBitmap, image->GetAspect(), iImageXDpi, iImageYDpi, iHorzAlign, iVertAlign); diff --git a/xfa/fxfa/cxfa_ffimageedit.cpp b/xfa/fxfa/cxfa_ffimageedit.cpp index 3b1338c4d1..525a9e90b9 100644 --- a/xfa/fxfa/cxfa_ffimageedit.cpp +++ b/xfa/fxfa/cxfa_ffimageedit.cpp @@ -74,14 +74,14 @@ 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_Para* para = m_pDataAcc->GetPara(); + CXFA_Para* para = m_pDataAcc->GetNode()->GetPara(); if (para) { iHorzAlign = para->GetHorizontalAlign(); iVertAlign = para->GetVerticalAlign(); } XFA_AttributeEnum iAspect = XFA_AttributeEnum::Fit; - CXFA_Value* value = m_pDataAcc->GetFormValue(); + CXFA_Value* value = m_pDataAcc->GetNode()->GetFormValue(); if (value) { CXFA_Image* image = value->GetImage(); if (image) diff --git a/xfa/fxfa/cxfa_ffline.cpp b/xfa/fxfa/cxfa_ffline.cpp index 7d3ce6a619..e9c00b01cb 100644 --- a/xfa/fxfa/cxfa_ffline.cpp +++ b/xfa/fxfa/cxfa_ffline.cpp @@ -87,7 +87,7 @@ void CXFA_FFLine::RenderWidget(CXFA_Graphics* pGS, if (!IsMatchVisibleStatus(dwStatus)) return; - CXFA_Value* value = m_pDataAcc->GetFormValue(); + CXFA_Value* value = m_pDataAcc->GetNode()->GetFormValue(); if (!value) return; @@ -111,7 +111,7 @@ void CXFA_FFLine::RenderWidget(CXFA_Graphics* pGS, mtRotate.Concat(matrix); CFX_RectF rtLine = GetRectWithoutRotate(); - CXFA_Margin* margin = m_pDataAcc->GetMargin(); + CXFA_Margin* margin = m_pDataAcc->GetNode()->GetMargin(); if (margin) XFA_RectWidthoutMargin(rtLine, margin); diff --git a/xfa/fxfa/cxfa_fflistbox.cpp b/xfa/fxfa/cxfa_fflistbox.cpp index 4099bdbfa6..d9eafb9812 100644 --- a/xfa/fxfa/cxfa_fflistbox.cpp +++ b/xfa/fxfa/cxfa_fflistbox.cpp @@ -105,7 +105,7 @@ bool CXFA_FFListBox::IsDataChanged() { } uint32_t CXFA_FFListBox::GetAlignment() { - CXFA_Para* para = m_pDataAcc->GetPara(); + CXFA_Para* para = m_pDataAcc->GetNode()->GetPara(); if (!para) return 0; diff --git a/xfa/fxfa/cxfa_ffpageview.cpp b/xfa/fxfa/cxfa_ffpageview.cpp index 9708bfc606..3fecf2e495 100644 --- a/xfa/fxfa/cxfa_ffpageview.cpp +++ b/xfa/fxfa/cxfa_ffpageview.cpp @@ -355,7 +355,8 @@ void CXFA_FFTabOrderPageWidgetIterator::CreateTabOrderWidgetArray() { while (true) { CXFA_FFWidget* pRadio = SpaceOrderWidgetArray[iWidgetIndex % nWidgetCount]; - if (pRadio->GetDataAcc()->GetExclGroup() != pWidgetAcc) { + if (pRadio->GetDataAcc()->GetNode()->GetExclGroup() != + pWidgetAcc->GetNode()) { break; } if (!pdfium::ContainsValue(m_TabOrderWidgetArray, hWidget)) { diff --git a/xfa/fxfa/cxfa_ffpushbutton.cpp b/xfa/fxfa/cxfa_ffpushbutton.cpp index a1250b5785..f42e5257b5 100644 --- a/xfa/fxfa/cxfa_ffpushbutton.cpp +++ b/xfa/fxfa/cxfa_ffpushbutton.cpp @@ -100,11 +100,11 @@ bool CXFA_FFPushButton::PerformLayout() { CFX_RectF rtWidget = GetRectWithoutRotate(); m_rtUI = rtWidget; - CXFA_Margin* margin = m_pDataAcc->GetMargin(); + CXFA_Margin* margin = m_pDataAcc->GetNode()->GetMargin(); if (margin) XFA_RectWidthoutMargin(rtWidget, margin); - CXFA_Caption* caption = m_pDataAcc->GetCaption(); + CXFA_Caption* caption = m_pDataAcc->GetNode()->GetCaption(); m_rtCaption = rtWidget; CXFA_Margin* captionMargin = caption->GetMargin(); if (captionMargin) @@ -118,7 +118,7 @@ bool CXFA_FFPushButton::PerformLayout() { return true; } float CXFA_FFPushButton::GetLineWidth() { - CXFA_Border* border = m_pDataAcc->GetBorder(false); + CXFA_Border* border = m_pDataAcc->GetNode()->GetBorder(false); if (border && border->GetPresence() == XFA_AttributeEnum::Visible) return border->GetEdge(0)->GetThickness(); return 0; @@ -133,7 +133,7 @@ FX_ARGB CXFA_FFPushButton::GetFillColor() { } void CXFA_FFPushButton::LoadHighlightCaption() { - CXFA_Caption* caption = m_pDataAcc->GetCaption(); + CXFA_Caption* caption = m_pDataAcc->GetNode()->GetCaption(); if (!caption || caption->IsHidden()) return; @@ -168,7 +168,7 @@ 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(); + CXFA_Caption* caption = m_pDataAcc->GetNode()->GetCaption(); if (!caption || !caption->IsVisible()) return; diff --git a/xfa/fxfa/cxfa_ffrectangle.cpp b/xfa/fxfa/cxfa_ffrectangle.cpp index 1ccb75c1c3..014c19cb97 100644 --- a/xfa/fxfa/cxfa_ffrectangle.cpp +++ b/xfa/fxfa/cxfa_ffrectangle.cpp @@ -20,12 +20,12 @@ void CXFA_FFRectangle::RenderWidget(CXFA_Graphics* pGS, if (!IsMatchVisibleStatus(dwStatus)) return; - CXFA_Value* value = m_pDataAcc->GetFormValue(); + CXFA_Value* value = m_pDataAcc->GetNode()->GetFormValue(); if (!value) return; CFX_RectF rect = GetRectWithoutRotate(); - CXFA_Margin* margin = m_pDataAcc->GetMargin(); + CXFA_Margin* margin = m_pDataAcc->GetNode()->GetMargin(); if (margin) XFA_RectWidthoutMargin(rect, margin); diff --git a/xfa/fxfa/cxfa_fftext.cpp b/xfa/fxfa/cxfa_fftext.cpp index 46a58c24c9..baeb8fde43 100644 --- a/xfa/fxfa/cxfa_fftext.cpp +++ b/xfa/fxfa/cxfa_fftext.cpp @@ -41,7 +41,7 @@ void CXFA_FFText::RenderWidget(CXFA_Graphics* pGS, CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice(); CFX_RectF rtText = GetRectWithoutRotate(); - CXFA_Margin* margin = m_pDataAcc->GetMargin(); + CXFA_Margin* margin = m_pDataAcc->GetNode()->GetMargin(); if (margin) { CXFA_LayoutItem* pItem = this; if (!pItem->GetPrev() && !pItem->GetNext()) { @@ -86,7 +86,7 @@ bool CXFA_FFText::PerformLayout() { pItem = pItem->GetFirst(); while (pItem) { CFX_RectF rtText = pItem->GetRect(false); - CXFA_Margin* margin = m_pDataAcc->GetMargin(); + CXFA_Margin* margin = m_pDataAcc->GetNode()->GetMargin(); if (margin) { if (!pItem->GetPrev()) rtText.height -= margin->GetTopInset(); diff --git a/xfa/fxfa/cxfa_fftextedit.cpp b/xfa/fxfa/cxfa_fftextedit.cpp index 3f4260c748..eeeb7b9e64 100644 --- a/xfa/fxfa/cxfa_fftextedit.cpp +++ b/xfa/fxfa/cxfa_fftextedit.cpp @@ -212,7 +212,7 @@ bool CXFA_FFTextEdit::IsDataChanged() { } uint32_t CXFA_FFTextEdit::GetAlignment() { - CXFA_Para* para = m_pDataAcc->GetPara(); + CXFA_Para* para = m_pDataAcc->GetNode()->GetPara(); if (!para) return 0; diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp index 2a844bbb82..54a666d3a8 100644 --- a/xfa/fxfa/cxfa_ffwidget.cpp +++ b/xfa/fxfa/cxfa_ffwidget.cpp @@ -943,7 +943,7 @@ const CFX_RectF& CXFA_FFWidget::RecacheWidgetRect() const { CFX_RectF CXFA_FFWidget::GetRectWithoutRotate() { CFX_RectF rtWidget = GetWidgetRect(); float fValue = 0; - switch (m_pDataAcc->GetRotate()) { + switch (m_pDataAcc->GetNode()->GetRotate()) { case 90: rtWidget.top = rtWidget.bottom(); fValue = rtWidget.width; @@ -988,7 +988,7 @@ void CXFA_FFWidget::RenderWidget(CXFA_Graphics* pGS, if (!IsMatchVisibleStatus(dwStatus)) return; - CXFA_Border* border = m_pDataAcc->GetBorder(false); + CXFA_Border* border = m_pDataAcc->GetNode()->GetBorder(false); if (!border) return; @@ -1261,7 +1261,7 @@ static void XFA_GetMatrix(CFX_Matrix& m, CFX_Matrix CXFA_FFWidget::GetRotateMatrix() { CFX_Matrix mt; - int32_t iRotate = m_pDataAcc->GetRotate(); + int32_t iRotate = m_pDataAcc->GetNode()->GetRotate(); if (!iRotate) return mt; diff --git a/xfa/fxfa/cxfa_ffwidgethandler.cpp b/xfa/fxfa/cxfa_ffwidgethandler.cpp index 79e48bab9b..ca4ef14a16 100644 --- a/xfa/fxfa/cxfa_ffwidgethandler.cpp +++ b/xfa/fxfa/cxfa_ffwidgethandler.cpp @@ -194,11 +194,11 @@ bool CXFA_FFWidgetHandler::HasEvent(CXFA_WidgetAcc* pWidgetAcc, switch (eEventType) { case XFA_EVENT_Calculate: { - CXFA_Calculate* calc = pWidgetAcc->GetCalculate(); + CXFA_Calculate* calc = pWidgetAcc->GetNode()->GetCalculate(); return calc && calc->GetScript(); } case XFA_EVENT_Validate: { - CXFA_Validate* validate = pWidgetAcc->GetValidate(false); + CXFA_Validate* validate = pWidgetAcc->GetNode()->GetValidate(false); return validate && validate->GetScript(); } default: @@ -228,7 +228,7 @@ int32_t CXFA_FFWidgetHandler::ProcessEvent(CXFA_WidgetAcc* pWidgetAcc, } return XFA_EVENTERROR_Disabled; case XFA_EVENT_InitCalculate: { - CXFA_Calculate* calc = pWidgetAcc->GetCalculate(); + CXFA_Calculate* calc = pWidgetAcc->GetNode()->GetCalculate(); if (!calc) return XFA_EVENTERROR_NotExist; if (pWidgetAcc->GetNode()->IsUserInteractive()) diff --git a/xfa/fxfa/cxfa_fwltheme.cpp b/xfa/fxfa/cxfa_fwltheme.cpp index f42c9ac022..ed54ab1a9d 100644 --- a/xfa/fxfa/cxfa_fwltheme.cpp +++ b/xfa/fxfa/cxfa_fwltheme.cpp @@ -134,8 +134,8 @@ void CXFA_FWLTheme::DrawText(CFWL_ThemeText* pParams) { m_pTextOut->SetStyles(pParams->m_dwTTOStyles); m_pTextOut->SetAlignment(pParams->m_iTTOAlign); m_pTextOut->SetFont(pAcc->GetFDEFont(pWidget->GetDoc())); - m_pTextOut->SetFontSize(pAcc->GetFontSize()); - m_pTextOut->SetTextColor(pAcc->GetTextColor()); + m_pTextOut->SetFontSize(pAcc->GetNode()->GetFontSize()); + m_pTextOut->SetTextColor(pAcc->GetNode()->GetTextColor()); CFX_Matrix mtPart = pParams->m_matrix; const CFX_Matrix* pMatrix = pGraphics->GetMatrix(); if (pMatrix) @@ -155,7 +155,7 @@ CFX_RectF CXFA_FWLTheme::GetUIMargin(CFWL_ThemePart* pThemePart) const { CXFA_LayoutItem* pItem = pWidget; CXFA_WidgetAcc* pWidgetAcc = pWidget->GetDataAcc(); rect = pWidgetAcc->GetUIMargin(); - CXFA_Para* para = pWidgetAcc->GetPara(); + CXFA_Para* para = pWidgetAcc->GetNode()->GetPara(); if (para) { rect.left += para->GetMarginLeft(); if (pWidgetAcc->IsMultiLine()) @@ -183,7 +183,7 @@ float CXFA_FWLTheme::GetCYBorderSize() const { float CXFA_FWLTheme::GetFontSize(CFWL_ThemePart* pThemePart) const { if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) - return pWidget->GetDataAcc()->GetFontSize(); + return pWidget->GetDataAcc()->GetNode()->GetFontSize(); return FWLTHEME_CAPACITY_FontSize; } @@ -196,7 +196,7 @@ RetainPtr<CFGAS_GEFont> CXFA_FWLTheme::GetFont( float CXFA_FWLTheme::GetLineHeight(CFWL_ThemePart* pThemePart) const { if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) - return pWidget->GetDataAcc()->GetLineHeight(); + return pWidget->GetDataAcc()->GetNode()->GetLineHeight(); return kLineHeight; } @@ -206,15 +206,14 @@ float CXFA_FWLTheme::GetScrollBarWidth() const { FX_COLORREF CXFA_FWLTheme::GetTextColor(CFWL_ThemePart* pThemePart) const { if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) - return pWidget->GetDataAcc()->GetTextColor(); + return pWidget->GetDataAcc()->GetNode()->GetTextColor(); return FWLTHEME_CAPACITY_TextColor; } 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_Para* para = pWidgetAcc->GetPara(); + CXFA_Para* para = pWidget->GetDataAcc()->GetNode()->GetPara(); if (para) { sizeAboveBelow.width = para->GetSpaceAbove(); sizeAboveBelow.height = para->GetSpaceBelow(); @@ -243,8 +242,8 @@ void CXFA_FWLTheme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { CXFA_WidgetAcc* pAcc = pWidget->GetDataAcc(); m_pTextOut->SetFont(pAcc->GetFDEFont(pWidget->GetDoc())); - m_pTextOut->SetFontSize(pAcc->GetFontSize()); - m_pTextOut->SetTextColor(pAcc->GetTextColor()); + m_pTextOut->SetFontSize(pAcc->GetNode()->GetFontSize()); + m_pTextOut->SetTextColor(pAcc->GetNode()->GetTextColor()); if (!pParams) return; diff --git a/xfa/fxfa/cxfa_textprovider.cpp b/xfa/fxfa/cxfa_textprovider.cpp index 5e1b48066f..e9ed0330a1 100644 --- a/xfa/fxfa/cxfa_textprovider.cpp +++ b/xfa/fxfa/cxfa_textprovider.cpp @@ -117,7 +117,7 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) { CXFA_Para* CXFA_TextProvider::GetPara() { if (m_eType == XFA_TEXTPROVIDERTYPE_Text) - return m_pWidgetAcc->GetPara(); + return m_pWidgetAcc->GetNode()->GetPara(); CXFA_Caption* pNode = m_pWidgetAcc->GetNode()->GetChild<CXFA_Caption>( 0, XFA_Element::Caption, false); @@ -126,19 +126,19 @@ CXFA_Para* CXFA_TextProvider::GetPara() { CXFA_Font* CXFA_TextProvider::GetFont() { if (m_eType == XFA_TEXTPROVIDERTYPE_Text) - return m_pWidgetAcc->GetFont(false); + return m_pWidgetAcc->GetNode()->GetFont(false); CXFA_Caption* pNode = m_pWidgetAcc->GetNode()->GetChild<CXFA_Caption>( 0, XFA_Element::Caption, false); CXFA_Font* font = pNode->GetChild<CXFA_Font>(0, XFA_Element::Font, false); - return font ? font : m_pWidgetAcc->GetFont(false); + return font ? font : m_pWidgetAcc->GetNode()->GetFont(false); } bool CXFA_TextProvider::IsCheckButtonAndAutoWidth() { XFA_Element eType = m_pWidgetAcc->GetUIType(); if (eType != XFA_Element::CheckButton) return false; - return !m_pWidgetAcc->TryWidth(); + return !m_pWidgetAcc->GetNode()->TryWidth(); } bool CXFA_TextProvider::GetEmbbedObj(bool bURI, diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp index dbd772ea6b..98661f10c8 100644 --- a/xfa/fxfa/cxfa_widgetacc.cpp +++ b/xfa/fxfa/cxfa_widgetacc.cpp @@ -95,7 +95,7 @@ class CXFA_ImageLayoutData : public CXFA_WidgetLayoutData { if (m_pDIBitmap) return true; - CXFA_Value* value = pAcc->GetFormValue(); + CXFA_Value* value = pAcc->GetNode()->GetFormValue(); if (!value) return false; @@ -122,7 +122,7 @@ class CXFA_FieldLayoutData : public CXFA_WidgetLayoutData { bool LoadCaption(CXFA_FFDoc* doc, CXFA_WidgetAcc* pAcc) { if (m_pCapTextLayout) return true; - CXFA_Caption* caption = pAcc->GetCaption(); + CXFA_Caption* caption = pAcc->GetNode()->GetCaption(); if (!caption || caption->IsHidden()) return false; @@ -152,7 +152,7 @@ class CXFA_ImageEditData : public CXFA_FieldLayoutData { if (m_pDIBitmap) return true; - CXFA_Value* value = pAcc->GetFormValue(); + CXFA_Value* value = pAcc->GetNode()->GetFormValue(); if (!value) return false; @@ -371,7 +371,7 @@ void CXFA_WidgetAcc::ResetData() { XFA_Element eUIType = GetUIType(); switch (eUIType) { case XFA_Element::ImageEdit: { - CXFA_Value* imageValue = GetDefaultValue(); + CXFA_Value* imageValue = m_pNode->GetDefaultValue(); CXFA_Image* image = imageValue ? imageValue->GetImage() : nullptr; WideString wsContentType, wsHref; if (image) { @@ -393,7 +393,7 @@ void CXFA_WidgetAcc::ResetData() { bool done = false; if (wsValue.IsEmpty()) { - CXFA_Value* defValue = pAcc->GetDefaultValue(); + CXFA_Value* defValue = pAcc->GetNode()->GetDefaultValue(); if (defValue) { wsValue = defValue->GetChildValueContent(); SetValue(XFA_VALUEPICTURE_Raw, wsValue); @@ -424,7 +424,7 @@ void CXFA_WidgetAcc::ResetData() { case XFA_Element::ChoiceList: ClearAllSelections(); default: { - CXFA_Value* defValue = GetDefaultValue(); + CXFA_Value* defValue = m_pNode->GetDefaultValue(); if (defValue) wsValue = defValue->GetChildValueContent(); @@ -437,7 +437,8 @@ void CXFA_WidgetAcc::ResetData() { void CXFA_WidgetAcc::SetImageEdit(const WideString& wsContentType, const WideString& wsHref, const WideString& wsData) { - CXFA_Image* image = GetFormValue() ? GetFormValue()->GetImage() : nullptr; + CXFA_Value* formValue = m_pNode->GetFormValue(); + CXFA_Image* image = formValue ? formValue->GetImage() : nullptr; if (image) { image->SetContentType(WideString(wsContentType)); image->SetHref(wsHref); @@ -463,13 +464,6 @@ void CXFA_WidgetAcc::SetImageEdit(const WideString& wsContentType, } } -CXFA_WidgetAcc* CXFA_WidgetAcc::GetExclGroup() { - CXFA_Node* pExcl = m_pNode->GetNodeItem(XFA_NODEITEM_Parent); - if (!pExcl || pExcl->GetElementType() != XFA_Element::ExclGroup) - return nullptr; - return pExcl->GetWidgetAcc(); -} - int32_t CXFA_WidgetAcc::ProcessEvent(CXFA_FFDocView* docView, XFA_AttributeEnum iActivity, CXFA_EventParam* pEventParam) { @@ -515,7 +509,7 @@ int32_t CXFA_WidgetAcc::ProcessCalculate(CXFA_FFDocView* docView) { if (m_pNode && m_pNode->GetElementType() == XFA_Element::Draw) return XFA_EVENTERROR_NotExist; - CXFA_Calculate* calc = GetCalculate(); + CXFA_Calculate* calc = m_pNode->GetCalculate(); if (!calc) return XFA_EVENTERROR_NotExist; if (GetNode()->IsUserInteractive()) @@ -527,7 +521,7 @@ int32_t CXFA_WidgetAcc::ProcessCalculate(CXFA_FFDocView* docView) { if (iRet != XFA_EVENTERROR_Success) return iRet; - if (GetRawValue() != EventParam.m_wsResult) { + if (m_pNode->GetRawValue() != EventParam.m_wsResult) { SetValue(XFA_VALUEPICTURE_Raw, EventParam.m_wsResult); UpdateUIDisplay(docView, nullptr); } @@ -576,7 +570,7 @@ void CXFA_WidgetAcc::ProcessScriptTestValidate(CXFA_FFDocView* docView, int32_t CXFA_WidgetAcc::ProcessFormatTestValidate(CXFA_FFDocView* docView, CXFA_Validate* validate, bool bVersionFlag) { - WideString wsRawValue = GetRawValue(); + WideString wsRawValue = m_pNode->GetRawValue(); if (!wsRawValue.IsEmpty()) { WideString wsPicture = validate->GetPicture(); if (wsPicture.IsEmpty()) @@ -696,7 +690,7 @@ WideString CXFA_WidgetAcc::GetValidateCaptionName(bool bVersionFlag) { WideString wsCaptionName; if (!bVersionFlag) { - CXFA_Caption* caption = GetCaption(); + CXFA_Caption* caption = m_pNode->GetCaption(); if (caption) { CXFA_Value* capValue = caption->GetValue(); if (capValue) { @@ -730,7 +724,7 @@ int32_t CXFA_WidgetAcc::ProcessValidate(CXFA_FFDocView* docView, if (m_pNode && m_pNode->GetElementType() == XFA_Element::Draw) return XFA_EVENTERROR_NotExist; - CXFA_Validate* validate = GetValidate(false); + CXFA_Validate* validate = m_pNode->GetValidate(false); if (!validate) return XFA_EVENTERROR_NotExist; @@ -740,7 +734,8 @@ int32_t CXFA_WidgetAcc::ProcessValidate(CXFA_FFDocView* docView, int32_t iRet = XFA_EVENTERROR_NotExist; CXFA_Script* script = validate->GetScript(); bool bRet = false; - bool hasBoolResult = (bInitDoc || bStatus) && GetRawValue().IsEmpty(); + bool hasBoolResult = + (bInitDoc || bStatus) && m_pNode->GetRawValue().IsEmpty(); if (script) { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_Validate; @@ -833,7 +828,7 @@ std::pair<int32_t, bool> CXFA_WidgetAcc::ExecuteBoolScript( } if (pEventParam->m_eType == XFA_EVENT_InitCalculate) { if ((iRet == XFA_EVENTERROR_Success) && - (GetRawValue() != pEventParam->m_wsResult)) { + (m_pNode->GetRawValue() != pEventParam->m_wsResult)) { SetValue(XFA_VALUEPICTURE_Raw, pEventParam->m_wsResult); docView->AddValidateWidget(this); } @@ -876,7 +871,7 @@ void CXFA_WidgetAcc::UpdateUIDisplay(CXFA_FFDocView* docView, } void CXFA_WidgetAcc::CalcCaptionSize(CXFA_FFDoc* doc, CFX_SizeF& szCap) { - CXFA_Caption* caption = GetCaption(); + CXFA_Caption* caption = m_pNode->GetCaption(); if (!caption || !caption->IsVisible()) return; @@ -905,7 +900,7 @@ void CXFA_WidgetAcc::CalcCaptionSize(CXFA_FFDoc* doc, CFX_SizeF& szCap) { if (font) { fFontSize = font->GetFontSize(); } else { - CXFA_Font* widgetfont = GetFont(false); + CXFA_Font* widgetfont = m_pNode->GetFont(false); if (widgetfont) fFontSize = widgetfont->GetFontSize(); } @@ -942,7 +937,7 @@ bool CXFA_WidgetAcc::CalculateFieldAutoSize(CXFA_FFDoc* doc, CFX_SizeF& size) { size.width += rtUIMargin.left + rtUIMargin.width; size.height += rtUIMargin.top + rtUIMargin.height; if (szCap.width > 0 && szCap.height > 0) { - switch (GetCaption()->GetPlacementType()) { + switch (m_pNode->GetCaption()->GetPlacementType()) { case XFA_AttributeEnum::Left: case XFA_AttributeEnum::Right: case XFA_AttributeEnum::Inline: { @@ -962,38 +957,38 @@ bool CXFA_WidgetAcc::CalculateFieldAutoSize(CXFA_FFDoc* doc, CFX_SizeF& size) { } bool CXFA_WidgetAcc::CalculateWidgetAutoSize(CFX_SizeF& size) { - CXFA_Margin* margin = GetMargin(); + CXFA_Margin* margin = m_pNode->GetMargin(); if (margin) { size.width += margin->GetLeftInset() + margin->GetRightInset(); size.height += margin->GetTopInset() + margin->GetBottomInset(); } - CXFA_Para* para = GetPara(); + CXFA_Para* para = m_pNode->GetPara(); if (para) size.width += para->GetMarginLeft() + para->GetTextIndent(); - Optional<float> width = TryWidth(); + Optional<float> width = m_pNode->TryWidth(); if (width) { size.width = *width; } else { - Optional<float> min = TryMinWidth(); + Optional<float> min = m_pNode->TryMinWidth(); if (min) size.width = std::max(size.width, *min); - Optional<float> max = TryMaxWidth(); + Optional<float> max = m_pNode->TryMaxWidth(); if (max && *max > 0) size.width = std::min(size.width, *max); } - Optional<float> height = TryHeight(); + Optional<float> height = m_pNode->TryHeight(); if (height) { size.height = *height; } else { - Optional<float> min = TryMinHeight(); + Optional<float> min = m_pNode->TryMinHeight(); if (min) size.height = std::max(size.height, *min); - Optional<float> max = TryMaxHeight(); + Optional<float> max = m_pNode->TryMaxHeight(); if (max && *max > 0) size.height = std::min(size.height, *max); } @@ -1002,7 +997,7 @@ bool CXFA_WidgetAcc::CalculateWidgetAutoSize(CFX_SizeF& size) { void CXFA_WidgetAcc::CalculateTextContentSize(CXFA_FFDoc* doc, CFX_SizeF& size) { - float fFontSize = GetFontSize(); + float fFontSize = m_pNode->GetFontSize(); WideString wsText = GetValue(XFA_VALUEPICTURE_Display); if (wsText.IsEmpty()) { size.height += fFontSize; @@ -1022,7 +1017,7 @@ void CXFA_WidgetAcc::CalculateTextContentSize(CXFA_FFDoc* doc, pTextOut->SetFont(GetFDEFont(doc)); pTextOut->SetFontSize(fFontSize); pTextOut->SetLineBreakTolerance(fFontSize * 0.2f); - pTextOut->SetLineSpace(GetLineHeight()); + pTextOut->SetLineSpace(m_pNode->GetLineHeight()); FDE_TextStyle dwStyles; dwStyles.last_line_height_ = true; @@ -1043,7 +1038,7 @@ bool CXFA_WidgetAcc::CalculateTextEditAutoSize(CXFA_FFDoc* doc, bool bCapExit = szCap.width > 0.01 && szCap.height > 0.01; XFA_AttributeEnum iCapPlacement = XFA_AttributeEnum::Unknown; if (bCapExit) { - iCapPlacement = GetCaption()->GetPlacementType(); + iCapPlacement = m_pNode->GetCaption()->GetPlacementType(); switch (iCapPlacement) { case XFA_AttributeEnum::Left: case XFA_AttributeEnum::Right: @@ -1056,7 +1051,7 @@ bool CXFA_WidgetAcc::CalculateTextEditAutoSize(CXFA_FFDoc* doc, } CFX_RectF rtUIMargin = GetUIMargin(); size.width -= rtUIMargin.left + rtUIMargin.width; - CXFA_Margin* margin = GetMargin(); + CXFA_Margin* margin = m_pNode->GetMargin(); if (margin) size.width -= margin->GetLeftInset() + margin->GetRightInset(); @@ -1105,7 +1100,7 @@ CFX_SizeF CXFA_WidgetAcc::CalculateImageSize(float img_width, XFA_UnitPx2Pt(img_height, dpi_y)); CFX_RectF rtFit; - Optional<float> width = TryWidth(); + Optional<float> width = m_pNode->TryWidth(); if (width) { rtFit.width = *width; GetWidthWithoutMargin(rtFit.width); @@ -1113,7 +1108,7 @@ CFX_SizeF CXFA_WidgetAcc::CalculateImageSize(float img_width, rtFit.width = rtImage.width; } - Optional<float> height = TryHeight(); + Optional<float> height = m_pNode->TryHeight(); if (height) { rtFit.height = *height; GetHeightWithoutMargin(rtFit.height); @@ -1193,15 +1188,15 @@ void CXFA_WidgetAcc::LoadText(CXFA_FFDoc* doc) { } float CXFA_WidgetAcc::CalculateWidgetAutoWidth(float fWidthCalc) { - CXFA_Margin* margin = GetMargin(); + CXFA_Margin* margin = m_pNode->GetMargin(); if (margin) fWidthCalc += margin->GetLeftInset() + margin->GetRightInset(); - Optional<float> min = TryMinWidth(); + Optional<float> min = m_pNode->TryMinWidth(); if (min) fWidthCalc = std::max(fWidthCalc, *min); - Optional<float> max = TryMaxWidth(); + Optional<float> max = m_pNode->TryMaxWidth(); if (max && *max > 0) fWidthCalc = std::min(fWidthCalc, *max); @@ -1209,22 +1204,22 @@ float CXFA_WidgetAcc::CalculateWidgetAutoWidth(float fWidthCalc) { } float CXFA_WidgetAcc::GetWidthWithoutMargin(float fWidthCalc) { - CXFA_Margin* margin = GetMargin(); + CXFA_Margin* margin = m_pNode->GetMargin(); if (margin) fWidthCalc -= margin->GetLeftInset() + margin->GetRightInset(); return fWidthCalc; } float CXFA_WidgetAcc::CalculateWidgetAutoHeight(float fHeightCalc) { - CXFA_Margin* margin = GetMargin(); + CXFA_Margin* margin = m_pNode->GetMargin(); if (margin) fHeightCalc += margin->GetTopInset() + margin->GetBottomInset(); - Optional<float> min = TryMinHeight(); + Optional<float> min = m_pNode->TryMinHeight(); if (min) fHeightCalc = std::max(fHeightCalc, *min); - Optional<float> max = TryMaxHeight(); + Optional<float> max = m_pNode->TryMaxHeight(); if (max && *max > 0) fHeightCalc = std::min(fHeightCalc, *max); @@ -1232,7 +1227,7 @@ float CXFA_WidgetAcc::CalculateWidgetAutoHeight(float fHeightCalc) { } float CXFA_WidgetAcc::GetHeightWithoutMargin(float fHeightCalc) { - CXFA_Margin* margin = GetMargin(); + CXFA_Margin* margin = m_pNode->GetMargin(); if (margin) fHeightCalc -= margin->GetTopInset() + margin->GetBottomInset(); return fHeightCalc; @@ -1245,7 +1240,7 @@ void CXFA_WidgetAcc::StartWidgetLayout(CXFA_FFDoc* doc, XFA_Element eUIType = GetUIType(); if (eUIType == XFA_Element::Text) { - m_pLayoutData->m_fWidgetHeight = TryHeight().value_or(-1); + m_pLayoutData->m_fWidgetHeight = m_pNode->TryHeight().value_or(-1); StartTextLayout(doc, fCalcWidth, fCalcHeight); return; } @@ -1255,7 +1250,7 @@ void CXFA_WidgetAcc::StartWidgetLayout(CXFA_FFDoc* doc, m_pLayoutData->m_fWidgetHeight = -1; float fWidth = 0; if (fCalcWidth > 0 && fCalcHeight < 0) { - Optional<float> height = TryHeight(); + Optional<float> height = m_pNode->TryHeight(); if (height) fCalcHeight = *height; else @@ -1266,11 +1261,11 @@ void CXFA_WidgetAcc::StartWidgetLayout(CXFA_FFDoc* doc, } if (fCalcWidth < 0 && fCalcHeight < 0) { Optional<float> height; - Optional<float> width = TryWidth(); + Optional<float> width = m_pNode->TryWidth(); if (width) { fWidth = *width; - height = TryHeight(); + height = m_pNode->TryHeight(); if (height) fCalcHeight = *height; } @@ -1343,7 +1338,7 @@ bool CXFA_WidgetAcc::FindSplitPos(CXFA_FFDocView* docView, float fTopInset = 0; float fBottomInset = 0; if (iBlockIndex == 0) { - CXFA_Margin* margin = GetMargin(); + CXFA_Margin* margin = m_pNode->GetMargin(); if (margin) { fTopInset = margin->GetTopInset(); fBottomInset = margin->GetBottomInset(); @@ -1377,7 +1372,7 @@ bool CXFA_WidgetAcc::FindSplitPos(CXFA_FFDocView* docView, XFA_AttributeEnum iCapPlacement = XFA_AttributeEnum::Unknown; float fCapReserve = 0; if (iBlockIndex == 0) { - CXFA_Caption* caption = GetCaption(); + CXFA_Caption* caption = m_pNode->GetCaption(); if (caption && !caption->IsHidden()) { iCapPlacement = caption->GetPlacementType(); fCapReserve = caption->GetReserve(); @@ -1405,7 +1400,7 @@ bool CXFA_WidgetAcc::FindSplitPos(CXFA_FFDocView* docView, if (!pFieldData->m_pTextOut) { // TODO(dsinclair): Inline fWidth when the 2nd param of // CalculateAccWidthAndHeight isn't a ref-param. - float fWidth = TryWidth().value_or(0); + float fWidth = m_pNode->TryWidth().value_or(0); CalculateAccWidthAndHeight(docView->GetDoc(), eUIType, fWidth, fHeight); } iLinesCount = pFieldData->m_pTextOut->GetTotalLines(); @@ -1419,15 +1414,15 @@ bool CXFA_WidgetAcc::FindSplitPos(CXFA_FFDocView* docView, if (iLinesCount == 0) return false; - float fLineHeight = GetLineHeight(); - float fFontSize = GetFontSize(); + float fLineHeight = m_pNode->GetLineHeight(); + float fFontSize = m_pNode->GetFontSize(); float fTextHeight = iLinesCount * fLineHeight - fLineHeight + fFontSize; float fSpaceAbove = 0; float fStartOffset = 0; if (fHeight > 0.1f && iBlockIndex == 0) { fStartOffset = fTopInset; fHeight -= (fTopInset + fBottomInset); - CXFA_Para* para = GetPara(); + CXFA_Para* para = m_pNode->GetPara(); if (para) { fSpaceAbove = para->GetSpaceAbove(); float fSpaceBelow = para->GetSpaceBelow(); @@ -1605,7 +1600,7 @@ void CXFA_WidgetAcc::StartTextLayout(CXFA_FFDoc* doc, } if (fCalcWidth < 0 && fCalcHeight < 0) { - Optional<float> width = TryWidth(); + Optional<float> width = m_pNode->TryWidth(); if (width) { pTextLayout->StartLayout(GetWidthWithoutMargin(*width)); fCalcWidth = *width; @@ -1679,7 +1674,7 @@ void CXFA_WidgetAcc::SetImageEditImage( RetainPtr<CFGAS_GEFont> CXFA_WidgetAcc::GetFDEFont(CXFA_FFDoc* doc) { WideString wsFontName = L"Courier"; uint32_t dwFontStyle = 0; - CXFA_Font* font = GetFont(false); + CXFA_Font* font = m_pNode->GetFont(false); if (font) { if (font->IsBold()) dwFontStyle |= FXFONT_BOLD; @@ -1692,31 +1687,9 @@ RetainPtr<CFGAS_GEFont> CXFA_WidgetAcc::GetFDEFont(CXFA_FFDoc* doc) { dwFontStyle); } -float CXFA_WidgetAcc::GetFontSize() { - CXFA_Font* font = GetFont(false); - float fFontSize = font ? font->GetFontSize() : 10.0f; - return fFontSize < 0.1f ? 10.0f : fFontSize; -} - -float CXFA_WidgetAcc::GetLineHeight() { - float fLineHeight = 0; - CXFA_Para* para = GetPara(); - if (para) - fLineHeight = para->GetLineHeight(); - if (fLineHeight < 1) - fLineHeight = GetFontSize() * 1.2f; - return fLineHeight; -} - -FX_ARGB CXFA_WidgetAcc::GetTextColor() { - CXFA_Font* font = GetFont(false); - return font ? font->GetColor() : 0xFF000000; -} - CXFA_Node* CXFA_WidgetAcc::GetUIChild() { if (m_eUIType == XFA_Element::Unknown) std::tie(m_eUIType, m_pUiChildNode) = CreateUIChild(m_pNode); - return m_pUiChildNode; } @@ -1725,50 +1698,8 @@ XFA_Element CXFA_WidgetAcc::GetUIType() { return m_eUIType; } -WideString CXFA_WidgetAcc::GetRawValue() const { - return m_pNode->JSObject()->GetContent(false); -} - bool CXFA_WidgetAcc::IsOpenAccess() const { - for (CXFA_Node* pNode = m_pNode; pNode; - pNode = pNode->GetNodeItem(XFA_NODEITEM_Parent, - XFA_ObjectType::ContainerNode)) { - XFA_AttributeEnum iAcc = pNode->JSObject()->GetEnum(XFA_Attribute::Access); - if (iAcc != XFA_AttributeEnum::Open) - return false; - } - return true; -} - -int32_t CXFA_WidgetAcc::GetRotate() const { - Optional<int32_t> degrees = - m_pNode->JSObject()->TryInteger(XFA_Attribute::Rotate, false); - return degrees ? XFA_MapRotation(*degrees) / 90 * 90 : 0; -} - -CXFA_Border* CXFA_WidgetAcc::GetBorder(bool bModified) { - return m_pNode->JSObject()->GetProperty<CXFA_Border>(0, XFA_Element::Border, - bModified); -} - -CXFA_Caption* CXFA_WidgetAcc::GetCaption() { - return m_pNode->JSObject()->GetProperty<CXFA_Caption>(0, XFA_Element::Caption, - false); -} - -CXFA_Font* CXFA_WidgetAcc::GetFont(bool bModified) { - return m_pNode->JSObject()->GetProperty<CXFA_Font>(0, XFA_Element::Font, - bModified); -} - -CXFA_Margin* CXFA_WidgetAcc::GetMargin() { - return m_pNode->JSObject()->GetProperty<CXFA_Margin>(0, XFA_Element::Margin, - false); -} - -CXFA_Para* CXFA_WidgetAcc::GetPara() { - return m_pNode->JSObject()->GetProperty<CXFA_Para>(0, XFA_Element::Para, - false); + return m_pNode && m_pNode->IsOpenAccess(); } std::vector<CXFA_Event*> CXFA_WidgetAcc::GetEventByActivity( @@ -1795,56 +1726,6 @@ std::vector<CXFA_Event*> CXFA_WidgetAcc::GetEventByActivity( return events; } -CXFA_Value* CXFA_WidgetAcc::GetDefaultValue() { - CXFA_Node* pTemNode = m_pNode->GetTemplateNode(); - return pTemNode->JSObject()->GetProperty<CXFA_Value>(0, XFA_Element::Value, - false); -} - -CXFA_Value* CXFA_WidgetAcc::GetFormValue() { - return m_pNode->JSObject()->GetProperty<CXFA_Value>(0, XFA_Element::Value, - false); -} - -CXFA_Calculate* CXFA_WidgetAcc::GetCalculate() { - return m_pNode->JSObject()->GetProperty<CXFA_Calculate>( - 0, XFA_Element::Calculate, false); -} - -CXFA_Validate* CXFA_WidgetAcc::GetValidate(bool bModified) { - return m_pNode->JSObject()->GetProperty<CXFA_Validate>( - 0, XFA_Element::Validate, bModified); -} - -CXFA_Bind* CXFA_WidgetAcc::GetBind() { - return m_pNode->JSObject()->GetProperty<CXFA_Bind>(0, XFA_Element::Bind, - false); -} - -Optional<float> CXFA_WidgetAcc::TryWidth() { - return m_pNode->JSObject()->TryMeasureAsFloat(XFA_Attribute::W); -} - -Optional<float> CXFA_WidgetAcc::TryHeight() { - return m_pNode->JSObject()->TryMeasureAsFloat(XFA_Attribute::H); -} - -Optional<float> CXFA_WidgetAcc::TryMinWidth() { - return m_pNode->JSObject()->TryMeasureAsFloat(XFA_Attribute::MinW); -} - -Optional<float> CXFA_WidgetAcc::TryMinHeight() { - return m_pNode->JSObject()->TryMeasureAsFloat(XFA_Attribute::MinH); -} - -Optional<float> CXFA_WidgetAcc::TryMaxWidth() { - return m_pNode->JSObject()->TryMeasureAsFloat(XFA_Attribute::MaxW); -} - -Optional<float> CXFA_WidgetAcc::TryMaxHeight() { - return m_pNode->JSObject()->TryMeasureAsFloat(XFA_Attribute::MaxH); -} - CXFA_Border* CXFA_WidgetAcc::GetUIBorder() { CXFA_Node* pUIChild = GetUIChild(); return pUIChild ? pUIChild->JSObject()->GetProperty<CXFA_Border>( @@ -1964,7 +1845,7 @@ bool CXFA_WidgetAcc::IsAllowNeutral() { } XFA_CHECKSTATE CXFA_WidgetAcc::GetCheckState() { - WideString wsValue = GetRawValue(); + WideString wsValue = m_pNode->GetRawValue(); if (wsValue.IsEmpty()) return XFA_CHECKSTATE_Off; @@ -1986,7 +1867,7 @@ XFA_CHECKSTATE CXFA_WidgetAcc::GetCheckState() { } void CXFA_WidgetAcc::SetCheckState(XFA_CHECKSTATE eCheckState, bool bNotify) { - CXFA_Node* node = GetExclGroupNode(); + CXFA_Node* node = m_pNode->GetExclGroup(); if (!node) { CXFA_Items* pItems = m_pNode->GetChild<CXFA_Items>(0, XFA_Element::Items, false); @@ -2046,16 +1927,9 @@ void CXFA_WidgetAcc::SetCheckState(XFA_CHECKSTATE eCheckState, bool bNotify) { node->SyncValue(wsValue, bNotify); } -CXFA_Node* CXFA_WidgetAcc::GetExclGroupNode() { - CXFA_Node* pExcl = ToNode(m_pNode->GetNodeItem(XFA_NODEITEM_Parent)); - if (!pExcl || pExcl->GetElementType() != XFA_Element::ExclGroup) - return nullptr; - return pExcl; -} - CXFA_Node* CXFA_WidgetAcc::GetSelectedMember() { CXFA_Node* pSelectedMember = nullptr; - WideString wsState = GetRawValue(); + WideString wsState = m_pNode->GetRawValue(); if (wsState.IsEmpty()) return pSelectedMember; @@ -2314,7 +2188,7 @@ std::vector<int32_t> CXFA_WidgetAcc::GetSelectedItems() { std::vector<WideString> CXFA_WidgetAcc::GetSelectedItemsValue() { std::vector<WideString> wsSelTextArray; - WideString wsValue = GetRawValue(); + WideString wsValue = m_pNode->GetRawValue(); if (IsChoiceListMultiSelect()) { if (!wsValue.IsEmpty()) { size_t iStart = 0; @@ -2363,7 +2237,7 @@ void CXFA_WidgetAcc::SetItemState(int32_t nIndex, if (IsChoiceListMultiSelect()) { if (bSelected) { if (iSel < 0) { - WideString wsValue = GetRawValue(); + WideString wsValue = m_pNode->GetRawValue(); if (!wsValue.IsEmpty()) { wsValue += L"\n"; } @@ -2968,7 +2842,7 @@ WideString CXFA_WidgetAcc::GetPictureContent(XFA_VALUEPICTURE ePicture) { } } case XFA_VALUEPICTURE_DataBind: { - CXFA_Bind* bind = GetBind(); + CXFA_Bind* bind = m_pNode->GetBind(); if (bind) return bind->GetPicture(); break; diff --git a/xfa/fxfa/cxfa_widgetacc.h b/xfa/fxfa/cxfa_widgetacc.h index 8d9bf6f753..44d2d2849a 100644 --- a/xfa/fxfa/cxfa_widgetacc.h +++ b/xfa/fxfa/cxfa_widgetacc.h @@ -62,8 +62,6 @@ class CXFA_WidgetAcc { void ResetData(); - CXFA_WidgetAcc* GetExclGroup(); - int32_t ProcessEvent(CXFA_FFDocView* docView, XFA_AttributeEnum iActivity, CXFA_EventParam* pEventParam); @@ -108,9 +106,6 @@ class CXFA_WidgetAcc { void UpdateUIDisplay(CXFA_FFDocView* docView, CXFA_FFWidget* pExcept); RetainPtr<CFGAS_GEFont> GetFDEFont(CXFA_FFDoc* doc); - float GetFontSize(); - FX_ARGB GetTextColor(); - float GetLineHeight(); CXFA_Node* GetNode() const { return m_pNode; } @@ -118,9 +113,6 @@ class CXFA_WidgetAcc { XFA_Element GetUIType(); CFX_RectF GetUIMargin(); - WideString GetRawValue() const; - int32_t GetRotate() const; - bool IsOpenAccess() const; bool IsListBox(); bool IsAllowNeutral(); @@ -128,27 +120,11 @@ class CXFA_WidgetAcc { bool IsChoiceListAllowTextEntry(); bool IsMultiLine(); - CXFA_Border* GetBorder(bool bModified); - CXFA_Caption* GetCaption(); - CXFA_Font* GetFont(bool bModified); - CXFA_Margin* GetMargin(); - CXFA_Para* GetPara(); - CXFA_Value* GetDefaultValue(); - CXFA_Value* GetFormValue(); - CXFA_Calculate* GetCalculate(); - CXFA_Validate* GetValidate(bool bModified); CXFA_Border* GetUIBorder(); std::vector<CXFA_Event*> GetEventByActivity(XFA_AttributeEnum iActivity, bool bIsFormReady); - Optional<float> TryWidth(); - Optional<float> TryHeight(); - Optional<float> TryMinWidth(); - Optional<float> TryMinHeight(); - Optional<float> TryMaxWidth(); - Optional<float> TryMaxHeight(); - XFA_AttributeEnum GetButtonHighlight(); bool HasButtonRollover() const; bool HasButtonDown() const; @@ -280,12 +256,10 @@ class CXFA_WidgetAcc { void InitLayoutData(); void StartTextLayout(CXFA_FFDoc* doc, float& fCalcWidth, float& fCalcHeight); - CXFA_Bind* GetBind(); void InsertListTextItem(CXFA_Node* pItems, const WideString& wsText, int32_t nIndex); WideString FormatNumStr(const WideString& wsValue, IFX_Locale* pLocale); - CXFA_Node* GetExclGroupNode(); void GetItemLabel(const WideStringView& wsValue, WideString& wsLabel); std::unique_ptr<CXFA_WidgetLayoutData> m_pLayoutData; diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index 141c9f1c6c..86d2300cb4 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -29,15 +29,24 @@ #include "xfa/fxfa/cxfa_ffwidget.h" #include "xfa/fxfa/parser/cxfa_arraynodelist.h" #include "xfa/fxfa/parser/cxfa_attachnodelist.h" +#include "xfa/fxfa/parser/cxfa_bind.h" +#include "xfa/fxfa/parser/cxfa_border.h" +#include "xfa/fxfa/parser/cxfa_calculate.h" +#include "xfa/fxfa/parser/cxfa_caption.h" #include "xfa/fxfa/parser/cxfa_document.h" +#include "xfa/fxfa/parser/cxfa_font.h" #include "xfa/fxfa/parser/cxfa_keep.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" +#include "xfa/fxfa/parser/cxfa_margin.h" #include "xfa/fxfa/parser/cxfa_measurement.h" #include "xfa/fxfa/parser/cxfa_nodeiteratortemplate.h" #include "xfa/fxfa/parser/cxfa_occur.h" +#include "xfa/fxfa/parser/cxfa_para.h" #include "xfa/fxfa/parser/cxfa_simple_parser.h" #include "xfa/fxfa/parser/cxfa_subform.h" #include "xfa/fxfa/parser/cxfa_traversestrategy_xfacontainernode.h" +#include "xfa/fxfa/parser/cxfa_validate.h" +#include "xfa/fxfa/parser/cxfa_value.h" #include "xfa/fxfa/parser/xfa_basic_data.h" #include "xfa/fxfa/parser/xfa_utils.h" @@ -1533,3 +1542,121 @@ void CXFA_Node::SyncValue(const WideString& wsValue, bool bNotify) { JSObject()->SetContent(wsValue, wsFormatValue, bNotify, false, true); } + +WideString CXFA_Node::GetRawValue() { + return JSObject()->GetContent(false); +} + +int32_t CXFA_Node::GetRotate() { + Optional<int32_t> degrees = + JSObject()->TryInteger(XFA_Attribute::Rotate, false); + return degrees ? XFA_MapRotation(*degrees) / 90 * 90 : 0; +} + +CXFA_Border* CXFA_Node::GetBorder(bool bModified) { + return JSObject()->GetProperty<CXFA_Border>(0, XFA_Element::Border, + bModified); +} + +CXFA_Caption* CXFA_Node::GetCaption() { + return JSObject()->GetProperty<CXFA_Caption>(0, XFA_Element::Caption, false); +} + +CXFA_Font* CXFA_Node::GetFont(bool bModified) { + return JSObject()->GetProperty<CXFA_Font>(0, XFA_Element::Font, bModified); +} + +float CXFA_Node::GetFontSize() { + CXFA_Font* font = GetFont(false); + float fFontSize = font ? font->GetFontSize() : 10.0f; + return fFontSize < 0.1f ? 10.0f : fFontSize; +} + +float CXFA_Node::GetLineHeight() { + float fLineHeight = 0; + CXFA_Para* para = GetPara(); + if (para) + fLineHeight = para->GetLineHeight(); + if (fLineHeight < 1) + fLineHeight = GetFontSize() * 1.2f; + return fLineHeight; +} + +FX_ARGB CXFA_Node::GetTextColor() { + CXFA_Font* font = GetFont(false); + return font ? font->GetColor() : 0xFF000000; +} + +CXFA_Margin* CXFA_Node::GetMargin() { + return JSObject()->GetProperty<CXFA_Margin>(0, XFA_Element::Margin, false); +} + +CXFA_Para* CXFA_Node::GetPara() { + return JSObject()->GetProperty<CXFA_Para>(0, XFA_Element::Para, false); +} + +bool CXFA_Node::IsOpenAccess() { + for (auto* pNode = this; pNode; + pNode = pNode->GetNodeItem(XFA_NODEITEM_Parent, + XFA_ObjectType::ContainerNode)) { + XFA_AttributeEnum iAcc = pNode->JSObject()->GetEnum(XFA_Attribute::Access); + if (iAcc != XFA_AttributeEnum::Open) + return false; + } + return true; +} + +CXFA_Value* CXFA_Node::GetDefaultValue() { + CXFA_Node* pTemNode = GetTemplateNode(); + return pTemNode->JSObject()->GetProperty<CXFA_Value>(0, XFA_Element::Value, + false); +} + +CXFA_Value* CXFA_Node::GetFormValue() { + return JSObject()->GetProperty<CXFA_Value>(0, XFA_Element::Value, false); +} + +CXFA_Calculate* CXFA_Node::GetCalculate() { + return JSObject()->GetProperty<CXFA_Calculate>(0, XFA_Element::Calculate, + false); +} + +CXFA_Validate* CXFA_Node::GetValidate(bool bModified) { + return JSObject()->GetProperty<CXFA_Validate>(0, XFA_Element::Validate, + bModified); +} + +CXFA_Bind* CXFA_Node::GetBind() { + return JSObject()->GetProperty<CXFA_Bind>(0, XFA_Element::Bind, false); +} + +Optional<float> CXFA_Node::TryWidth() { + return JSObject()->TryMeasureAsFloat(XFA_Attribute::W); +} + +Optional<float> CXFA_Node::TryHeight() { + return JSObject()->TryMeasureAsFloat(XFA_Attribute::H); +} + +Optional<float> CXFA_Node::TryMinWidth() { + return JSObject()->TryMeasureAsFloat(XFA_Attribute::MinW); +} + +Optional<float> CXFA_Node::TryMinHeight() { + return JSObject()->TryMeasureAsFloat(XFA_Attribute::MinH); +} + +Optional<float> CXFA_Node::TryMaxWidth() { + return JSObject()->TryMeasureAsFloat(XFA_Attribute::MaxW); +} + +Optional<float> CXFA_Node::TryMaxHeight() { + return JSObject()->TryMeasureAsFloat(XFA_Attribute::MaxH); +} + +CXFA_Node* CXFA_Node::GetExclGroup() { + CXFA_Node* pExcl = GetNodeItem(XFA_NODEITEM_Parent); + if (!pExcl || pExcl->GetElementType() != XFA_Element::ExclGroup) + return nullptr; + return pExcl; +} diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h index c8adbfe080..4def12caaf 100644 --- a/xfa/fxfa/parser/cxfa_node.h +++ b/xfa/fxfa/parser/cxfa_node.h @@ -218,6 +218,37 @@ class CXFA_Node : public CXFA_Object { void SyncValue(const WideString& wsValue, bool bNotify); + bool IsOpenAccess(); + + CXFA_Border* GetBorder(bool bModified); + CXFA_Caption* GetCaption(); + + CXFA_Font* GetFont(bool bModified); + float GetFontSize(); + FX_ARGB GetTextColor(); + float GetLineHeight(); + + CXFA_Margin* GetMargin(); + CXFA_Para* GetPara(); + CXFA_Calculate* GetCalculate(); + CXFA_Validate* GetValidate(bool bModified); + + CXFA_Value* GetDefaultValue(); + CXFA_Value* GetFormValue(); + WideString GetRawValue(); + int32_t GetRotate(); + + CXFA_Bind* GetBind(); + + Optional<float> TryWidth(); + Optional<float> TryHeight(); + Optional<float> TryMinWidth(); + Optional<float> TryMinHeight(); + Optional<float> TryMaxWidth(); + Optional<float> TryMaxHeight(); + + CXFA_Node* GetExclGroup(); + protected: CXFA_Node(CXFA_Document* pDoc, XFA_PacketType ePacket, diff --git a/xfa/fxfa/parser/xfa_utils.cpp b/xfa/fxfa/parser/xfa_utils.cpp index c41835f19c..3342776adb 100644 --- a/xfa/fxfa/parser/xfa_utils.cpp +++ b/xfa/fxfa/parser/xfa_utils.cpp @@ -457,7 +457,7 @@ CXFA_LocaleValue XFA_GetLocaleValue(CXFA_WidgetAcc* pWidgetAcc) { iVTType = XFA_VT_NULL; break; } - return CXFA_LocaleValue(iVTType, pWidgetAcc->GetRawValue(), + return CXFA_LocaleValue(iVTType, pWidgetAcc->GetNode()->GetRawValue(), pWidgetAcc->GetNode()->GetDocument()->GetLocalMgr()); } |