void CXFA_FFPushButton::RenderHighlightCaption(CFX_Graphics* pGS, CFX_Matrix* pMatrix) { CXFA_TextLayout* pCapTextLayout = m_pDataAcc->GetCaptionTextLayout(); CXFA_Caption caption = m_pDataAcc->GetCaption(); if (caption && caption.GetPresence() == XFA_ATTRIBUTEENUM_Visible) { CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice(); CFX_RectF rtWidget; GetRectWithoutRotate(rtWidget); CFX_RectF rtClip = m_rtCaption; rtClip.Intersect(rtWidget); CFX_Matrix mt; mt.Set(1, 0, 0, 1, m_rtCaption.left, m_rtCaption.top); if (pMatrix) { pMatrix->TransformRect(rtClip); mt.Concat(*pMatrix); } { uint32_t dwState = m_pNormalWidget->GetStates(); if (m_pDownTextLayout && (dwState & FWL_STATE_PSB_Pressed) && (dwState & FWL_STATE_PSB_Hovered)) { if (m_pDownTextLayout->DrawString(pRenderDevice, mt, rtClip)) { return; } } else if (m_pRolloverTextLayout && (dwState & FWL_STATE_PSB_Hovered)) { if (m_pRolloverTextLayout->DrawString(pRenderDevice, mt, rtClip)) { return; } } } if (pCapTextLayout) { pCapTextLayout->DrawString(pRenderDevice, mt, rtClip); } } }
void CXFA_FFField::LayoutCaption() { CXFA_TextLayout* pCapTextLayout = m_pDataAcc->GetCaptionTextLayout(); if (!pCapTextLayout) return; FX_FLOAT fHeight = 0; pCapTextLayout->Layout(CFX_SizeF(m_rtCaption.width, m_rtCaption.height), &fHeight); if (m_rtCaption.height < fHeight) m_rtCaption.height = fHeight; }
void CXFA_FFField::RenderCaption(CFX_Graphics* pGS, CFX_Matrix* pMatrix) { CXFA_TextLayout* pCapTextLayout = m_pDataAcc->GetCaptionTextLayout(); if (!pCapTextLayout) { return; } CXFA_Caption caption = m_pDataAcc->GetCaption(); if (caption && caption.GetPresence() == XFA_ATTRIBUTEENUM_Visible) { if (!pCapTextLayout->IsLoaded()) { pCapTextLayout->Layout(CFX_SizeF(m_rtCaption.width, m_rtCaption.height)); } CFX_RectF rtWidget; GetRectWithoutRotate(rtWidget); CFX_RectF rtClip = m_rtCaption; rtClip.Intersect(rtWidget); CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice(); CFX_Matrix mt; mt.Set(1, 0, 0, 1, m_rtCaption.left, m_rtCaption.top); if (pMatrix) { pMatrix->TransformRect(rtClip); mt.Concat(*pMatrix); } pCapTextLayout->DrawString(pRenderDevice, mt, rtClip); } }
void CXFA_FFNotify::OnValueChanged(CXFA_Node* pSender, XFA_ATTRIBUTE eAttr, CXFA_Node* pParentNode, CXFA_Node* pWidgetNode) { CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); if (!pDocView) return; if (!(pSender->GetPacketID() & XFA_XDPPACKET_Form)) { if (eAttr == XFA_ATTRIBUTE_Value) pDocView->AddCalculateNodeNotify(pSender); return; } XFA_Element eType = pParentNode->GetElementType(); FX_BOOL bIsContainerNode = pParentNode->IsContainerNode(); CXFA_WidgetAcc* pWidgetAcc = static_cast<CXFA_WidgetAcc*>(pWidgetNode->GetWidgetData()); if (!pWidgetAcc) return; bool bUpdateProperty = false; pDocView->SetChangeMark(); switch (eType) { case XFA_Element::Caption: { CXFA_TextLayout* pCapOut = pWidgetAcc->GetCaptionTextLayout(); if (!pCapOut) return; pCapOut->Unload(); } break; case XFA_Element::Ui: case XFA_Element::Para: bUpdateProperty = true; break; default: break; } if (bIsContainerNode && eAttr == XFA_ATTRIBUTE_Access) bUpdateProperty = true; if (eAttr == XFA_ATTRIBUTE_Value) { pDocView->AddCalculateNodeNotify(pSender); if (eType == XFA_Element::Value || bIsContainerNode) { if (bIsContainerNode) { pWidgetAcc->UpdateUIDisplay(); pDocView->AddCalculateWidgetAcc(pWidgetAcc); pDocView->AddValidateWidget(pWidgetAcc); } else if (pWidgetNode->GetNodeItem(XFA_NODEITEM_Parent) ->GetElementType() == XFA_Element::ExclGroup) { pWidgetAcc->UpdateUIDisplay(); } return; } } CXFA_FFWidget* pWidget = nullptr; while ((pWidget = pWidgetAcc->GetNextWidget(pWidget)) != nullptr) { if (!pWidget->IsLoaded()) continue; if (bUpdateProperty) pWidget->UpdateWidgetProperty(); pWidget->PerformLayout(); pWidget->AddInvalidateRect(); } }
void CXFA_FFField::CapPlacement() { CFX_RectF rtWidget; GetRectWithoutRotate(rtWidget); CXFA_Margin mgWidget = m_pDataAcc->GetMargin(); if (mgWidget) { CXFA_LayoutItem* pItem = this; FX_FLOAT fLeftInset = 0, fRightInset = 0, fTopInset = 0, fBottomInset = 0; mgWidget.GetLeftInset(fLeftInset); mgWidget.GetRightInset(fRightInset); mgWidget.GetTopInset(fTopInset); mgWidget.GetBottomInset(fBottomInset); if (!pItem->GetPrev() && !pItem->GetNext()) { rtWidget.Deflate(fLeftInset, fTopInset, fRightInset, fBottomInset); } else { if (!pItem->GetPrev()) { rtWidget.Deflate(fLeftInset, fTopInset, fRightInset, 0); } else if (!pItem->GetNext()) { rtWidget.Deflate(fLeftInset, 0, fRightInset, fBottomInset); } else { rtWidget.Deflate(fLeftInset, 0, fRightInset, 0); } } } XFA_ATTRIBUTEENUM iCapPlacement = XFA_ATTRIBUTEENUM_Unknown; FX_FLOAT fCapReserve = 0; CXFA_Caption caption = m_pDataAcc->GetCaption(); if (caption && caption.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) { iCapPlacement = (XFA_ATTRIBUTEENUM)caption.GetPlacementType(); if (iCapPlacement == XFA_ATTRIBUTEENUM_Top && GetPrev()) { m_rtCaption.Set(0, 0, 0, 0); } else if (iCapPlacement == XFA_ATTRIBUTEENUM_Bottom && GetNext()) { m_rtCaption.Set(0, 0, 0, 0); } else { fCapReserve = caption.GetReserve(); CXFA_LayoutItem* pItem = this; if (!pItem->GetPrev() && !pItem->GetNext()) { m_rtCaption.Set(rtWidget.left, rtWidget.top, rtWidget.width, rtWidget.height); } else { pItem = pItem->GetFirst(); pItem->GetRect(m_rtCaption); pItem = pItem->GetNext(); while (pItem) { CFX_RectF rtRect; pItem->GetRect(rtRect); m_rtCaption.height += rtRect.Height(); pItem = pItem->GetNext(); } XFA_RectWidthoutMargin(m_rtCaption, mgWidget); } CXFA_TextLayout* pCapTextLayout = m_pDataAcc->GetCaptionTextLayout(); if (fCapReserve <= 0 && pCapTextLayout) { CFX_SizeF size; CFX_SizeF minSize; CFX_SizeF maxSize; pCapTextLayout->CalcSize(minSize, maxSize, size); if (iCapPlacement == XFA_ATTRIBUTEENUM_Top || iCapPlacement == XFA_ATTRIBUTEENUM_Bottom) { fCapReserve = size.y; } else { fCapReserve = size.x; } } } } m_rtUI = rtWidget; switch (iCapPlacement) { case XFA_ATTRIBUTEENUM_Left: { m_rtCaption.width = fCapReserve; CapLeftRightPlacement(caption, rtWidget, iCapPlacement); m_rtUI.width -= fCapReserve; m_rtUI.left += fCapReserve; } break; case XFA_ATTRIBUTEENUM_Top: { m_rtCaption.height = fCapReserve; CapTopBottomPlacement(caption, rtWidget, iCapPlacement); m_rtUI.top += fCapReserve; m_rtUI.height -= fCapReserve; } break; case XFA_ATTRIBUTEENUM_Right: { m_rtCaption.left = m_rtCaption.right() - fCapReserve; m_rtCaption.width = fCapReserve; CapLeftRightPlacement(caption, rtWidget, iCapPlacement); m_rtUI.width -= fCapReserve; } break; case XFA_ATTRIBUTEENUM_Bottom: { m_rtCaption.top = m_rtCaption.bottom() - fCapReserve; m_rtCaption.height = fCapReserve; CapTopBottomPlacement(caption, rtWidget, iCapPlacement); m_rtUI.height -= fCapReserve; } break; case XFA_ATTRIBUTEENUM_Inline: break; default: break; } CXFA_Border borderUI = m_pDataAcc->GetUIBorder(); if (borderUI) { CXFA_Margin margin = borderUI.GetMargin(); if (margin) { XFA_RectWidthoutMargin(m_rtUI, margin); } } m_rtUI.Normalize(); }