summaryrefslogtreecommitdiff
path: root/xfa/fwl
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-04-13 10:14:26 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-13 10:14:26 -0700
commiteb9cf677ca1bfd9431e43804b5524a1cf9bd9a8f (patch)
treeaa728330ce8dc8251487e35d18b3bcdd2a120c1d /xfa/fwl
parenta364fad07e5baf4a72ea734e64fb55664cab075e (diff)
downloadpdfium-eb9cf677ca1bfd9431e43804b5524a1cf9bd9a8f.tar.xz
Remove IFX_Barcode.
This CL replaces IFX_Barcode with the concrete class. BUG=pdfium:468 Review URL: https://codereview.chromium.org/1890443002
Diffstat (limited to 'xfa/fwl')
-rw-r--r--xfa/fwl/basewidget/fwl_barcodeimp.cpp12
-rw-r--r--xfa/fwl/basewidget/fwl_barcodeimp.h29
-rw-r--r--xfa/fwl/basewidget/fxmath_barcodeimp.cpp8
-rw-r--r--xfa/fwl/basewidget/fxmath_barcodeimp.h74
-rw-r--r--xfa/fwl/basewidget/ifx_barcode.h62
5 files changed, 64 insertions, 121 deletions
diff --git a/xfa/fwl/basewidget/fwl_barcodeimp.cpp b/xfa/fwl/basewidget/fwl_barcodeimp.cpp
index 0ab2e1ed74..771d7b9833 100644
--- a/xfa/fwl/basewidget/fwl_barcodeimp.cpp
+++ b/xfa/fwl/basewidget/fwl_barcodeimp.cpp
@@ -7,6 +7,7 @@
#include "xfa/fwl/basewidget/fwl_barcodeimp.h"
#include "xfa/fwl/basewidget/fwl_editimp.h"
+#include "xfa/fwl/basewidget/fxmath_barcodeimp.h"
#include "xfa/fwl/core/cfwl_themepart.h"
#include "xfa/fwl/core/fwl_noteimp.h"
#include "xfa/fwl/core/fwl_targetimp.h"
@@ -174,11 +175,18 @@ void CFWL_BarcodeImp::GenerateBarcodeImageCache() {
? XFA_BCS_EncodeSuccess
: 0;
}
+
void CFWL_BarcodeImp::CreateBarcodeEngine() {
- if ((m_pBarcodeEngine == NULL) && (m_type != BC_UNKNOWN)) {
- m_pBarcodeEngine = FX_Barcode_Create(m_type);
+ if (m_pBarcodeEngine || m_type == BC_UNKNOWN)
+ return;
+
+ m_pBarcodeEngine = new CFX_Barcode;
+ if (!m_pBarcodeEngine->Create(m_type)) {
+ m_pBarcodeEngine->Release();
+ m_pBarcodeEngine = nullptr;
}
}
+
void CFWL_BarcodeImp::ReleaseBarcodeEngine() {
if (m_pBarcodeEngine) {
m_pBarcodeEngine->Release();
diff --git a/xfa/fwl/basewidget/fwl_barcodeimp.h b/xfa/fwl/basewidget/fwl_barcodeimp.h
index 77b3552a63..eacecc3c4e 100644
--- a/xfa/fwl/basewidget/fwl_barcodeimp.h
+++ b/xfa/fwl/basewidget/fwl_barcodeimp.h
@@ -10,10 +10,10 @@
#include "xfa/fwl/basewidget/fwl_editimp.h"
#include "xfa/fwl/basewidget/ifwl_barcode.h"
#include "xfa/fwl/basewidget/ifwl_scrollbar.h"
-#include "xfa/fwl/basewidget/ifx_barcode.h"
class CFWL_WidgetImpProperties;
class CFWL_BarcodeImpDelegate;
+class CFX_Barcode;
class IFWL_Widget;
#define XFA_BCS_NeedUpdate 0x0001
@@ -23,26 +23,29 @@ class CFWL_BarcodeImp : public CFWL_EditImp {
public:
CFWL_BarcodeImp(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter);
- virtual ~CFWL_BarcodeImp();
- virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const;
- virtual uint32_t GetClassID() const;
- virtual FWL_ERR Initialize();
- virtual FWL_ERR Finalize();
- virtual FWL_ERR Update();
- virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix = NULL);
- virtual FWL_ERR SetText(const CFX_WideString& wsText);
- virtual void SetType(BC_TYPE type);
+ ~CFWL_BarcodeImp() override;
+
+ FWL_ERR GetClassName(CFX_WideString& wsClass) const override;
+ uint32_t GetClassID() const override;
+ FWL_ERR Initialize() override;
+ FWL_ERR Finalize() override;
+ FWL_ERR Update() override;
+ FWL_ERR DrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix = nullptr) override;
+ FWL_ERR SetText(const CFX_WideString& wsText) override;
+ void SetType(BC_TYPE type);
FX_BOOL IsProtectedType();
protected:
+ friend class CFWL_BarcodeImpDelegate;
+
void GenerateBarcodeImageCache();
void CreateBarcodeEngine();
void ReleaseBarcodeEngine();
- IFX_Barcode* m_pBarcodeEngine;
+
+ CFX_Barcode* m_pBarcodeEngine;
uint32_t m_dwStatus;
BC_TYPE m_type;
- friend class CFWL_BarcodeImpDelegate;
};
class CFWL_BarcodeImpDelegate : public CFWL_EditImpDelegate {
diff --git a/xfa/fwl/basewidget/fxmath_barcodeimp.cpp b/xfa/fwl/basewidget/fxmath_barcodeimp.cpp
index 9792c6f7cc..5ca0927671 100644
--- a/xfa/fwl/basewidget/fxmath_barcodeimp.cpp
+++ b/xfa/fwl/basewidget/fxmath_barcodeimp.cpp
@@ -386,11 +386,3 @@ CFX_WideString CFX_Barcode::Decode(CFX_DIBitmap* pBitmap, int32_t& errorCode) {
errorCode = BCExceptionUnSupportedBarcode;
return CFX_WideString();
}
-IFX_Barcode* FX_Barcode_Create(BC_TYPE type) {
- CFX_Barcode* pBarcode = new CFX_Barcode;
- if (pBarcode->Create(type)) {
- return pBarcode;
- }
- pBarcode->Release();
- return NULL;
-}
diff --git a/xfa/fwl/basewidget/fxmath_barcodeimp.h b/xfa/fwl/basewidget/fxmath_barcodeimp.h
index bcad0489e6..b52e900f90 100644
--- a/xfa/fwl/basewidget/fxmath_barcodeimp.h
+++ b/xfa/fwl/basewidget/fxmath_barcodeimp.h
@@ -7,53 +7,55 @@
#ifndef XFA_FWL_BASEWIDGET_FXMATH_BARCODEIMP_H_
#define XFA_FWL_BASEWIDGET_FXMATH_BARCODEIMP_H_
+#include "core/fxcrt/include/fx_coordinates.h"
#include "core/fxcrt/include/fx_string.h"
#include "core/fxcrt/include/fx_system.h"
-#include "xfa/fwl/basewidget/ifx_barcode.h"
+#include "core/fxge/include/fx_dib.h"
#include "xfa/fxbarcode/include/BC_Library.h"
class CBC_CodeBase;
+class CFX_Font;
+class CFX_RenderDevice;
+class CFX_Matrix;
-class CFX_Barcode : public IFX_Barcode {
+class CFX_Barcode {
public:
CFX_Barcode();
~CFX_Barcode();
FX_BOOL Create(BC_TYPE type);
- virtual void Release();
- virtual BC_TYPE GetType();
- virtual FX_BOOL Encode(const CFX_WideStringC& contents,
- FX_BOOL isDevice,
- int32_t& e);
- virtual FX_BOOL RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matirx,
- int32_t& e);
- virtual FX_BOOL RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e);
- virtual CFX_WideString Decode(uint8_t* buf,
- int32_t width,
- int32_t height,
- int32_t& errorCode);
- virtual CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& errorCode);
- virtual FX_BOOL SetCharEncoding(BC_CHAR_ENCODING encoding);
- virtual FX_BOOL SetModuleHeight(int32_t moduleHeight);
- virtual FX_BOOL SetModuleWidth(int32_t moduleWidth);
- virtual FX_BOOL SetHeight(int32_t height);
- virtual FX_BOOL SetWidth(int32_t width);
- virtual FX_BOOL CheckContentValidity(const CFX_WideStringC& contents);
- virtual FX_BOOL SetPrintChecksum(FX_BOOL checksum);
- virtual FX_BOOL SetDataLength(int32_t length);
- virtual FX_BOOL SetCalChecksum(int32_t state);
- virtual FX_BOOL SetFont(CFX_Font* pFont);
- virtual FX_BOOL SetFontSize(FX_FLOAT size);
- virtual FX_BOOL SetFontStyle(int32_t style);
- virtual FX_BOOL SetFontColor(FX_ARGB color);
- virtual FX_BOOL SetTextLocation(BC_TEXT_LOC location);
- virtual FX_BOOL SetWideNarrowRatio(int32_t ratio);
- virtual FX_BOOL SetStartChar(FX_CHAR start);
- virtual FX_BOOL SetEndChar(FX_CHAR end);
- virtual FX_BOOL SetVersion(int32_t version);
- virtual FX_BOOL SetErrorCorrectionLevel(int32_t level);
- virtual FX_BOOL SetTruncated(FX_BOOL truncated);
+ void Release();
+ BC_TYPE GetType();
+ FX_BOOL Encode(const CFX_WideStringC& contents, FX_BOOL isDevice, int32_t& e);
+ FX_BOOL RenderDevice(CFX_RenderDevice* device,
+ const CFX_Matrix* matirx,
+ int32_t& e);
+ FX_BOOL RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e);
+ CFX_WideString Decode(uint8_t* buf,
+ int32_t width,
+ int32_t height,
+ int32_t& errorCode);
+ CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& errorCode);
+ FX_BOOL SetCharEncoding(BC_CHAR_ENCODING encoding);
+ FX_BOOL SetModuleHeight(int32_t moduleHeight);
+ FX_BOOL SetModuleWidth(int32_t moduleWidth);
+ FX_BOOL SetHeight(int32_t height);
+ FX_BOOL SetWidth(int32_t width);
+ FX_BOOL CheckContentValidity(const CFX_WideStringC& contents);
+ FX_BOOL SetPrintChecksum(FX_BOOL checksum);
+ FX_BOOL SetDataLength(int32_t length);
+ FX_BOOL SetCalChecksum(int32_t state);
+ FX_BOOL SetFont(CFX_Font* pFont);
+ FX_BOOL SetFontSize(FX_FLOAT size);
+ FX_BOOL SetFontStyle(int32_t style);
+ FX_BOOL SetFontColor(FX_ARGB color);
+ FX_BOOL SetTextLocation(BC_TEXT_LOC location);
+ FX_BOOL SetWideNarrowRatio(int32_t ratio);
+ FX_BOOL SetStartChar(FX_CHAR start);
+ FX_BOOL SetEndChar(FX_CHAR end);
+ FX_BOOL SetVersion(int32_t version);
+ FX_BOOL SetErrorCorrectionLevel(int32_t level);
+ FX_BOOL SetTruncated(FX_BOOL truncated);
protected:
CBC_CodeBase* m_pBCEngine;
diff --git a/xfa/fwl/basewidget/ifx_barcode.h b/xfa/fwl/basewidget/ifx_barcode.h
deleted file mode 100644
index 2cad68cbeb..0000000000
--- a/xfa/fwl/basewidget/ifx_barcode.h
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FWL_BASEWIDGET_IFX_BARCODE_H_
-#define XFA_FWL_BASEWIDGET_IFX_BARCODE_H_
-
-#include "core/fxcrt/include/fx_string.h"
-#include "core/fxcrt/include/fx_system.h"
-#include "core/fxge/include/fx_dib.h"
-#include "xfa/fxbarcode/include/BC_Library.h"
-
-class CFX_Font;
-class CFX_Matrix;
-class CFX_RenderDevice;
-
-class IFX_Barcode {
- public:
- virtual ~IFX_Barcode() {}
-
- virtual void Release() = 0;
-
- virtual BC_TYPE GetType() = 0;
- virtual FX_BOOL Encode(const CFX_WideStringC& contents,
- FX_BOOL isDevice,
- int32_t& e) = 0;
- virtual FX_BOOL RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matirx,
- int32_t& e) = 0;
- virtual FX_BOOL RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) = 0;
- virtual CFX_WideString Decode(uint8_t* buf,
- int32_t width,
- int32_t height,
- int32_t& errorCode) = 0;
- virtual CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& errorCode) = 0;
- virtual FX_BOOL SetCharEncoding(BC_CHAR_ENCODING encoding) = 0;
- virtual FX_BOOL SetModuleHeight(int32_t moduleHeight) = 0;
- virtual FX_BOOL SetModuleWidth(int32_t moduleWidth) = 0;
- virtual FX_BOOL SetHeight(int32_t height) = 0;
- virtual FX_BOOL SetWidth(int32_t width) = 0;
- virtual FX_BOOL CheckContentValidity(const CFX_WideStringC& contents) = 0;
- virtual FX_BOOL SetPrintChecksum(FX_BOOL checksum) = 0;
- virtual FX_BOOL SetDataLength(int32_t length) = 0;
- virtual FX_BOOL SetCalChecksum(int32_t state) = 0;
- virtual FX_BOOL SetFont(CFX_Font* pFont) = 0;
- virtual FX_BOOL SetFontSize(FX_FLOAT size) = 0;
- virtual FX_BOOL SetFontStyle(int32_t style) = 0;
- virtual FX_BOOL SetFontColor(FX_ARGB color) = 0;
- virtual FX_BOOL SetTextLocation(BC_TEXT_LOC location) = 0;
- virtual FX_BOOL SetWideNarrowRatio(int32_t ratio) = 0;
- virtual FX_BOOL SetStartChar(FX_CHAR start) = 0;
- virtual FX_BOOL SetEndChar(FX_CHAR end) = 0;
- virtual FX_BOOL SetVersion(int32_t version) = 0;
- virtual FX_BOOL SetErrorCorrectionLevel(int32_t level) = 0;
- virtual FX_BOOL SetTruncated(FX_BOOL truncated) = 0;
-};
-
-IFX_Barcode* FX_Barcode_Create(BC_TYPE type);
-
-#endif // XFA_FWL_BASEWIDGET_IFX_BARCODE_H_