7#include "xfa/fxfa/cxfa_ffbarcode.h"
11#include "core/fxcrt/check.h"
12#include "core/fxcrt/fx_extension.h"
13#include "xfa/fwl/cfwl_app.h"
14#include "xfa/fwl/cfwl_barcode.h"
15#include "xfa/fwl/cfwl_notedriver.h"
16#include "xfa/fxfa/cxfa_fffield.h"
17#include "xfa/fxfa/cxfa_ffpageview.h"
18#include "xfa/fxfa/cxfa_ffwidget.h"
19#include "xfa/fxfa/cxfa_fwladapterwidgetmgr.h"
20#include "xfa/fxfa/parser/cxfa_barcode.h"
21#include "xfa/fxfa/parser/cxfa_border.h"
31const BarCodeInfo kBarCodeData[] = {
117 if (wsName.IsEmpty())
120 auto* it =
std::lower_bound(
121 std::begin(kBarCodeData),
std::end(kBarCodeData),
122 FX_HashCode_GetLoweredW(wsName.AsStringView()),
123 [](
const BarCodeInfo& arg, uint32_t hash) {
return arg.uHash < hash; });
131CXFA_FFBarcode::CXFA_FFBarcode(
CXFA_Node* pNode, CXFA_Barcode* barcode)
136void CXFA_FFBarcode::Trace(
cppgc::Visitor* visitor)
const {
137 CXFA_FFTextEdit::Trace(visitor);
138 visitor->Trace(barcode_);
144 CFWL_Barcode* pFWLBarcode = cppgc::MakeGarbageCollected<CFWL_Barcode>(
145 GetFWLApp()->GetHeap()->GetAllocationHandle(), GetFWLApp());
149 CFWL_NoteDriver* pNoteDriver = pFWLBarcode
->GetFWLApp()->GetNoteDriver();
151 m_pOldDelegate = pFWLBarcode->GetDelegate();
156 pFWLBarcode
->SetText(m_pNode->GetValue(XFA_ValuePicture::kDisplay));
173 DrawBorder(pGS, m_pNode->GetUIBorder(), m_UIRect, mtRotate);
175 CFX_RectF rtWidget = GetNormalWidget()->GetWidgetRect();
179 GetNormalWidget()->DrawWidget(pGS, mt);
189 auto* pBarCodeWidget =
static_cast<CFWL_Barcode*>(GetNormalWidget());
190 pBarCodeWidget->SetType(bc_type);
192 std::optional<
bool> calcChecksum = barcode_->GetChecksum();
193 if (calcChecksum.has_value())
194 pBarCodeWidget->SetCalChecksum(calcChecksum.value());
196 std::optional<int32_t> dataLen = barcode_->GetDataLength();
197 if (dataLen.has_value())
198 pBarCodeWidget->SetDataLength(dataLen.value());
200 std::optional<
char> startChar = barcode_->GetStartChar();
201 if (startChar.has_value())
202 pBarCodeWidget->SetStartChar(startChar.value());
204 std::optional<
char> endChar = barcode_->GetEndChar();
205 if (endChar.has_value())
206 pBarCodeWidget->SetEndChar(endChar.value());
208 std::optional<int32_t> ecLevel = barcode_->GetECLevel();
209 if (ecLevel.has_value())
210 pBarCodeWidget->SetErrorCorrectionLevel(ecLevel.value());
212 std::optional<int32_t> width = barcode_->GetModuleWidth();
213 if (width.has_value())
214 pBarCodeWidget->SetModuleWidth(width.value());
216 std::optional<int32_t> height = barcode_->GetModuleHeight();
217 if (height.has_value())
218 pBarCodeWidget->SetModuleHeight(height.value());
220 std::optional<
bool> printCheck = barcode_->GetPrintChecksum();
221 if (printCheck.has_value())
222 pBarCodeWidget->SetPrintChecksum(printCheck.value());
225 if (text_attr.has_value()) {
227 TextLocFromAttribute(text_attr.value());
228 if (textLoc.has_value())
229 pBarCodeWidget->SetTextLocation(textLoc.value());
234 std::optional<int8_t> ratio = barcode_->GetWideNarrowRatio();
235 if (ratio.has_value())
236 pBarCodeWidget->SetWideNarrowRatio(ratio.value());
240 pBarCodeWidget->SetPrintChecksum(
true);
248 auto* pBarCodeWidget =
static_cast<CFWL_Barcode*>(GetNormalWidget());
249 if (!pBarCodeWidget || pBarCodeWidget->IsProtectedType())
251 if (command == CFWL_MessageMouse::MouseCommand::kLeftButtonDown &&
252 !m_pNode->IsOpenAccess()) {
constexpr CFX_Matrix(float a1, float b1, float c1, float d1, float e1, float f1)
void Concat(const CFX_Matrix &right)
void RenderWidget(CFGAS_GEGraphics *pGS, const CFX_Matrix &matrix, HighlightOption highlight) override
bool AcceptsFocusOnButtonDown(Mask< XFA_FWL_KeyFlag > dwFlags, const CFX_PointF &point, CFWL_MessageMouse::MouseCommand command) override
static BC_TYPE GetBarcodeTypeByName(const WideString &wsName)
void UpdateWidgetProperty() override
bool LoadWidget() override
~CXFA_FFBarcode() override
bool LoadWidget() override
void SetNormalWidget(CFWL_Widget *widget)
void RenderCaption(CFGAS_GEGraphics *pGS, const CFX_Matrix &pMatrix)
bool AcceptsFocusOnButtonDown(Mask< XFA_FWL_KeyFlag > dwFlags, const CFX_PointF &point, CFWL_MessageMouse::MouseCommand command) override
CXFA_FFTextEdit(CXFA_Node *pNode)
void UpdateWidgetProperty() override
bool EqualsASCII(ByteStringView that) const
void SetText(const WideString &wsText) override
void RegisterEventTarget(CFWL_Widget *pListener, CFWL_Widget *pEventSource)
CFX_PTemplate< float > CFX_PointF
fxcrt::WideString WideString