| Index: xfa/fwl/core/ifwl_barcode.cpp
|
| diff --git a/xfa/fwl/basewidget/fwl_barcodeimp.cpp b/xfa/fwl/core/ifwl_barcode.cpp
|
| similarity index 75%
|
| rename from xfa/fwl/basewidget/fwl_barcodeimp.cpp
|
| rename to xfa/fwl/core/ifwl_barcode.cpp
|
| index 70f5c73c3a70b6206f7968618915f7433d8689ea..76f64facd028fd8b7ae22513f72eb612d7841254 100644
|
| --- a/xfa/fwl/basewidget/fwl_barcodeimp.cpp
|
| +++ b/xfa/fwl/core/ifwl_barcode.cpp
|
| @@ -4,73 +4,58 @@
|
|
|
| // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
|
|
|
| -#include "xfa/fwl/basewidget/fwl_barcodeimp.h"
|
| +#include "xfa/fwl/core/ifwl_barcode.h"
|
|
|
| #include "xfa/fgas/font/fgas_gefont.h"
|
| -#include "xfa/fwl/basewidget/cfx_barcode.h"
|
| -#include "xfa/fwl/basewidget/fwl_editimp.h"
|
| #include "xfa/fwl/core/cfwl_themepart.h"
|
| +#include "xfa/fwl/core/cfx_barcode.h"
|
| #include "xfa/fwl/core/fwl_noteimp.h"
|
| -#include "xfa/fwl/core/fwl_widgetimp.h"
|
| #include "xfa/fwl/core/ifwl_themeprovider.h"
|
|
|
| // static
|
| IFWL_Barcode* IFWL_Barcode::Create(const CFWL_WidgetImpProperties& properties) {
|
| - IFWL_Barcode* pBarcode = new IFWL_Barcode;
|
| - CFWL_BarcodeImp* pBarcodeImpl = new CFWL_BarcodeImp(properties, nullptr);
|
| - pBarcode->SetImpl(pBarcodeImpl);
|
| - pBarcodeImpl->SetInterface(pBarcode);
|
| - return pBarcode;
|
| -}
|
| -IFWL_Barcode::IFWL_Barcode() {}
|
| -void IFWL_Barcode::SetType(BC_TYPE type) {
|
| - static_cast<CFWL_BarcodeImp*>(GetImpl())->SetType(type);
|
| -}
|
| -FX_BOOL IFWL_Barcode::IsProtectedType() {
|
| - return static_cast<CFWL_BarcodeImp*>(GetImpl())->IsProtectedType();
|
| + return new IFWL_Barcode(properties, nullptr);
|
| }
|
|
|
| -CFWL_BarcodeImp::CFWL_BarcodeImp(const CFWL_WidgetImpProperties& properties,
|
| - IFWL_Widget* pOuter)
|
| - : CFWL_EditImp(properties, pOuter),
|
| - m_dwStatus(0),
|
| - m_type(BC_UNKNOWN) {}
|
| +IFWL_Barcode::IFWL_Barcode(const CFWL_WidgetImpProperties& properties,
|
| + IFWL_Widget* pOuter)
|
| + : IFWL_Edit(properties, pOuter), m_dwStatus(0), m_type(BC_UNKNOWN) {}
|
|
|
| -CFWL_BarcodeImp::~CFWL_BarcodeImp() {}
|
| +IFWL_Barcode::~IFWL_Barcode() {}
|
|
|
| -FWL_Error CFWL_BarcodeImp::GetClassName(CFX_WideString& wsClass) const {
|
| +FWL_Error IFWL_Barcode::GetClassName(CFX_WideString& wsClass) const {
|
| wsClass = FWL_CLASS_Barcode;
|
| return FWL_Error::Succeeded;
|
| }
|
|
|
| -FWL_Type CFWL_BarcodeImp::GetClassID() const {
|
| +FWL_Type IFWL_Barcode::GetClassID() const {
|
| return FWL_Type::Barcode;
|
| }
|
|
|
| -FWL_Error CFWL_BarcodeImp::Initialize() {
|
| +FWL_Error IFWL_Barcode::Initialize() {
|
| if (!m_pDelegate) {
|
| m_pDelegate = new CFWL_BarcodeImpDelegate(this);
|
| }
|
| - if (CFWL_EditImp::Initialize() != FWL_Error::Succeeded)
|
| + if (IFWL_Edit::Initialize() != FWL_Error::Succeeded)
|
| return FWL_Error::Indefinite;
|
| return FWL_Error::Succeeded;
|
| }
|
| -FWL_Error CFWL_BarcodeImp::Finalize() {
|
| +FWL_Error IFWL_Barcode::Finalize() {
|
| delete m_pDelegate;
|
| m_pDelegate = nullptr;
|
| m_pBarcodeEngine.reset();
|
| - return CFWL_EditImp::Finalize();
|
| + return IFWL_Edit::Finalize();
|
| }
|
| -FWL_Error CFWL_BarcodeImp::Update() {
|
| +FWL_Error IFWL_Barcode::Update() {
|
| if (IsLocked()) {
|
| return FWL_Error::Indefinite;
|
| }
|
| - FWL_Error ret = CFWL_EditImp::Update();
|
| + FWL_Error ret = IFWL_Edit::Update();
|
| GenerateBarcodeImageCache();
|
| return ret;
|
| }
|
| -FWL_Error CFWL_BarcodeImp::DrawWidget(CFX_Graphics* pGraphics,
|
| - const CFX_Matrix* pMatrix) {
|
| +FWL_Error IFWL_Barcode::DrawWidget(CFX_Graphics* pGraphics,
|
| + const CFX_Matrix* pMatrix) {
|
| if (!pGraphics)
|
| return FWL_Error::Indefinite;
|
| if (!m_pProperties->m_pThemeProvider)
|
| @@ -93,9 +78,9 @@ FWL_Error CFWL_BarcodeImp::DrawWidget(CFX_Graphics* pGraphics,
|
| }
|
| return FWL_Error::Succeeded;
|
| }
|
| - return CFWL_EditImp::DrawWidget(pGraphics, pMatrix);
|
| + return IFWL_Edit::DrawWidget(pGraphics, pMatrix);
|
| }
|
| -void CFWL_BarcodeImp::GenerateBarcodeImageCache() {
|
| +void IFWL_Barcode::GenerateBarcodeImageCache() {
|
| if ((m_dwStatus & XFA_BCS_NeedUpdate) == 0)
|
| return;
|
| m_dwStatus = 0;
|
| @@ -110,7 +95,7 @@ void CFWL_BarcodeImp::GenerateBarcodeImageCache() {
|
| if (GetText(wsText) != FWL_Error::Succeeded)
|
| return;
|
| CFWL_ThemePart part;
|
| - part.m_pWidget = m_pInterface;
|
| + part.m_pWidget = this;
|
| IFWL_ThemeProvider* pTheme = GetAvailableTheme();
|
| CFGAS_GEFont* pFont = static_cast<CFGAS_GEFont*>(
|
| pTheme->GetCapacity(&part, CFWL_WidgetCapacity::Font));
|
| @@ -176,7 +161,7 @@ void CFWL_BarcodeImp::GenerateBarcodeImageCache() {
|
| : 0;
|
| }
|
|
|
| -void CFWL_BarcodeImp::CreateBarcodeEngine() {
|
| +void IFWL_Barcode::CreateBarcodeEngine() {
|
| if (m_pBarcodeEngine || m_type == BC_UNKNOWN)
|
| return;
|
|
|
| @@ -185,7 +170,7 @@ void CFWL_BarcodeImp::CreateBarcodeEngine() {
|
| m_pBarcodeEngine = std::move(pBarcode);
|
| }
|
|
|
| -void CFWL_BarcodeImp::SetType(BC_TYPE type) {
|
| +void IFWL_Barcode::SetType(BC_TYPE type) {
|
| if (m_type == type)
|
| return;
|
|
|
| @@ -193,12 +178,12 @@ void CFWL_BarcodeImp::SetType(BC_TYPE type) {
|
| m_type = type;
|
| m_dwStatus = XFA_BCS_NeedUpdate;
|
| }
|
| -FWL_Error CFWL_BarcodeImp::SetText(const CFX_WideString& wsText) {
|
| +FWL_Error IFWL_Barcode::SetText(const CFX_WideString& wsText) {
|
| m_pBarcodeEngine.reset();
|
| m_dwStatus = XFA_BCS_NeedUpdate;
|
| - return CFWL_EditImp::SetText(wsText);
|
| + return IFWL_Edit::SetText(wsText);
|
| }
|
| -FX_BOOL CFWL_BarcodeImp::IsProtectedType() {
|
| +FX_BOOL IFWL_Barcode::IsProtectedType() {
|
| if (!m_pBarcodeEngine) {
|
| return TRUE;
|
| }
|
| @@ -210,12 +195,12 @@ FX_BOOL CFWL_BarcodeImp::IsProtectedType() {
|
| return FALSE;
|
| }
|
|
|
| -CFWL_BarcodeImpDelegate::CFWL_BarcodeImpDelegate(CFWL_BarcodeImp* pOwner)
|
| +CFWL_BarcodeImpDelegate::CFWL_BarcodeImpDelegate(IFWL_Barcode* pOwner)
|
| : CFWL_EditImpDelegate(pOwner) {}
|
|
|
| void CFWL_BarcodeImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {
|
| if (pEvent->GetClassID() == CFWL_EventType::TextChanged) {
|
| - CFWL_BarcodeImp* pOwner = static_cast<CFWL_BarcodeImp*>(m_pOwner);
|
| + IFWL_Barcode* pOwner = static_cast<IFWL_Barcode*>(m_pOwner);
|
| pOwner->m_pBarcodeEngine.reset();
|
| pOwner->m_dwStatus = XFA_BCS_NeedUpdate;
|
| }
|
|
|