From 59cdc7dc88310bd8cdf2ace60e0f567561d38dbb Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 29 Jan 2018 20:38:16 +0000 Subject: Move barcode code to CXFA_Barcode This CL moves the barcode specific code out of CXFA_Node and into CXFA_Barcode. The CXFA_FFBarcode widget was modified to take the barcode as a parameter. Change-Id: I8ff91cb58402665f4ba63f2eeced45feeaa9ff50 Reviewed-on: https://pdfium-review.googlesource.com/24450 Commit-Queue: dsinclair Reviewed-by: Ryan Harrison --- xfa/fxfa/cxfa_ffbarcode.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'xfa/fxfa/cxfa_ffbarcode.cpp') diff --git a/xfa/fxfa/cxfa_ffbarcode.cpp b/xfa/fxfa/cxfa_ffbarcode.cpp index ce3ca6b791..c458696ce8 100644 --- a/xfa/fxfa/cxfa_ffbarcode.cpp +++ b/xfa/fxfa/cxfa_ffbarcode.cpp @@ -17,6 +17,7 @@ #include "xfa/fxfa/cxfa_ffpageview.h" #include "xfa/fxfa/cxfa_ffwidget.h" #include "xfa/fxfa/cxfa_fwladapterwidgetmgr.h" +#include "xfa/fxfa/parser/cxfa_barcode.h" #include "xfa/fxfa/parser/cxfa_border.h" namespace { @@ -111,7 +112,8 @@ const BarCodeInfo* CXFA_FFBarcode::GetBarcodeTypeByName( return nullptr; } -CXFA_FFBarcode::CXFA_FFBarcode(CXFA_Node* pNode) : CXFA_FFTextEdit(pNode) {} +CXFA_FFBarcode::CXFA_FFBarcode(CXFA_Node* pNode, CXFA_Barcode* barcode) + : CXFA_FFTextEdit(pNode), barcode_(barcode) {} CXFA_FFBarcode::~CXFA_FFBarcode() {} @@ -157,60 +159,58 @@ void CXFA_FFBarcode::RenderWidget(CXFA_Graphics* pGS, void CXFA_FFBarcode::UpdateWidgetProperty() { CXFA_FFTextEdit::UpdateWidgetProperty(); - auto* node = GetNode(); - const BarCodeInfo* info = GetBarcodeTypeByName(node->GetBarcodeType()); + const BarCodeInfo* info = GetBarcodeTypeByName(barcode_->GetBarcodeType()); if (!info) return; auto* pBarCodeWidget = static_cast(m_pNormalWidget.get()); pBarCodeWidget->SetType(info->eBCType); - Optional encoding = - node->GetBarcodeAttribute_CharEncoding(); + Optional encoding = barcode_->GetCharEncoding(); if (encoding) pBarCodeWidget->SetCharEncoding(*encoding); - Optional calcChecksum = node->GetBarcodeAttribute_Checksum(); + Optional calcChecksum = barcode_->GetChecksum(); if (calcChecksum) pBarCodeWidget->SetCalChecksum(*calcChecksum); - Optional dataLen = node->GetBarcodeAttribute_DataLength(); + Optional dataLen = barcode_->GetDataLength(); if (dataLen) pBarCodeWidget->SetDataLength(*dataLen); - Optional startChar = node->GetBarcodeAttribute_StartChar(); + Optional startChar = barcode_->GetStartChar(); if (startChar) pBarCodeWidget->SetStartChar(*startChar); - Optional endChar = node->GetBarcodeAttribute_EndChar(); + Optional endChar = barcode_->GetEndChar(); if (endChar) pBarCodeWidget->SetEndChar(*endChar); - Optional ecLevel = node->GetBarcodeAttribute_ECLevel(); + Optional ecLevel = barcode_->GetECLevel(); if (ecLevel) pBarCodeWidget->SetErrorCorrectionLevel(*ecLevel); - Optional width = node->GetBarcodeAttribute_ModuleWidth(); + Optional width = barcode_->GetModuleWidth(); if (width) pBarCodeWidget->SetModuleWidth(*width); - Optional height = node->GetBarcodeAttribute_ModuleHeight(); + Optional height = barcode_->GetModuleHeight(); if (height) pBarCodeWidget->SetModuleHeight(*height); - Optional printCheck = node->GetBarcodeAttribute_PrintChecksum(); + Optional printCheck = barcode_->GetPrintChecksum(); if (printCheck) pBarCodeWidget->SetPrintChecksum(*printCheck); - Optional textLoc = node->GetBarcodeAttribute_TextLocation(); + Optional textLoc = barcode_->GetTextLocation(); if (textLoc) pBarCodeWidget->SetTextLocation(*textLoc); - Optional truncate = node->GetBarcodeAttribute_Truncate(); + Optional truncate = barcode_->GetTruncate(); if (truncate) pBarCodeWidget->SetTruncated(*truncate); - Optional ratio = node->GetBarcodeAttribute_WideNarrowRatio(); + Optional ratio = barcode_->GetWideNarrowRatio(); if (ratio) pBarCodeWidget->SetWideNarrowRatio(*ratio); -- cgit v1.2.3