diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2016-03-21 15:15:56 -0400 |
---|---|---|
committer | Dan Sinclair <dsinclair@chromium.org> | 2016-03-21 15:15:56 -0400 |
commit | a98600aeb8d815c297834aa5006f5c3ea20dde6d (patch) | |
tree | f5e8d107353a1355378f096098c58b01b3d8f828 /xfa/include | |
parent | 69bbb0010cb83a7fa63d0901df6aef1de0ccfc0c (diff) | |
download | pdfium-a98600aeb8d815c297834aa5006f5c3ea20dde6d.tar.xz |
Move xfa/include/fxbarcode/BC_Barcode.h to xfa/fxbarcode.
This CL splits apart the larger header into individual class headers in the
xfa/fxbarcode directory.
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1816133002 .
Diffstat (limited to 'xfa/include')
-rw-r--r-- | xfa/include/fwl/basewidget/fwl_barcode.h | 5 | ||||
-rw-r--r-- | xfa/include/fwl/basewidget/fxmath_barcode.h | 12 | ||||
-rw-r--r-- | xfa/include/fwl/lightwidget/barcode.h | 1 | ||||
-rw-r--r-- | xfa/include/fxbarcode/BC_BarCode.h | 257 |
4 files changed, 14 insertions, 261 deletions
diff --git a/xfa/include/fwl/basewidget/fwl_barcode.h b/xfa/include/fwl/basewidget/fwl_barcode.h index 944dd4aa6c..0d3db83421 100644 --- a/xfa/include/fwl/basewidget/fwl_barcode.h +++ b/xfa/include/fwl/basewidget/fwl_barcode.h @@ -7,11 +7,11 @@ #ifndef XFA_INCLUDE_FWL_BASEWIDGET_FWL_BARCODE_H_ #define XFA_INCLUDE_FWL_BASEWIDGET_FWL_BARCODE_H_ +#include "xfa/fxbarcode/include/BC_Library.h" #include "xfa/include/fwl/basewidget/fwl_edit.h" -#include "xfa/include/fxbarcode/BC_BarCode.h" class CFWL_WidgetImpProperties; -class IFWL_Barcode; + #define FWL_CLASS_Barcode L"FWL_BARCODE" #define FWL_CLASSHASH_Barcode 366886968 #define FWL_BCDATTRIBUTE_CHARENCODING (1L << 0) @@ -31,6 +31,7 @@ class IFWL_Barcode; #define FWL_PART_BCD_Edge 2 #define FWL_PART_BCD_Background 3 #define FWL_BCUPDATECMD_Data FWL_WGTUPDATECMD_User + class IFWL_BarcodeDP : public IFWL_EditDP { public: virtual BC_CHAR_ENCODING GetCharEncoding() = 0; diff --git a/xfa/include/fwl/basewidget/fxmath_barcode.h b/xfa/include/fwl/basewidget/fxmath_barcode.h index c6ef766f7f..58ce11727c 100644 --- a/xfa/include/fwl/basewidget/fxmath_barcode.h +++ b/xfa/include/fwl/basewidget/fxmath_barcode.h @@ -7,12 +7,21 @@ #ifndef XFA_INCLUDE_FWL_BASEWIDGET_FXMATH_BARCODE_H_ #define XFA_INCLUDE_FWL_BASEWIDGET_FXMATH_BARCODE_H_ -#include "xfa/include/fxbarcode/BC_BarCode.h" +#include "core/include/fxcrt/fx_string.h" +#include "core/include/fxcrt/fx_system.h" +#include "core/include/fxge/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, @@ -47,6 +56,7 @@ class IFX_Barcode { 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_INCLUDE_FWL_BASEWIDGET_FXMATH_BARCODE_H_ diff --git a/xfa/include/fwl/lightwidget/barcode.h b/xfa/include/fwl/lightwidget/barcode.h index 2dec2a8806..7056f3ac58 100644 --- a/xfa/include/fwl/lightwidget/barcode.h +++ b/xfa/include/fwl/lightwidget/barcode.h @@ -10,7 +10,6 @@ #include "xfa/include/fwl/basewidget/fwl_barcode.h" #include "xfa/include/fwl/core/fwl_error.h" #include "xfa/include/fwl/lightwidget/edit.h" -#include "xfa/include/fxbarcode/BC_BarCode.h" class CFWL_Widget; class CFWL_WidgetProperties; diff --git a/xfa/include/fxbarcode/BC_BarCode.h b/xfa/include/fxbarcode/BC_BarCode.h deleted file mode 100644 index 84745acb77..0000000000 --- a/xfa/include/fxbarcode/BC_BarCode.h +++ /dev/null @@ -1,257 +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_INCLUDE_FXBARCODE_BC_BARCODE_H_ -#define XFA_INCLUDE_FXBARCODE_BC_BARCODE_H_ - -#include "core/include/fxcrt/fx_string.h" -#include "core/include/fxcrt/fx_system.h" -#include "core/include/fxge/fx_dib.h" - -class CBC_Reader; -class CBC_Writer; -class CFX_Font; -class CFX_RenderDevice; - -enum BC_TEXT_LOC { - BC_TEXT_LOC_NONE = 0, - BC_TEXT_LOC_ABOVE, - BC_TEXT_LOC_BELOW, - BC_TEXT_LOC_ABOVEEMBED, - BC_TEXT_LOC_BELOWEMBED -}; - -enum BC_CHAR_ENCODING { CHAR_ENCODING_UTF8 = 0, CHAR_ENCODING_UNICODE }; - -enum BC_TYPE { - BC_UNKNOWN = -1, - BC_CODE39 = 0, - BC_CODABAR, - BC_CODE128, - BC_CODE128_B, - BC_CODE128_C, - BC_EAN8, - BC_UPCA, - BC_EAN13, - BC_QR_CODE, - BC_PDF417, - BC_DATAMATRIX -}; - -void BC_Library_Init(); -void BC_Library_Destory(); - -class CBC_CodeBase { - public: - CBC_CodeBase(); - virtual ~CBC_CodeBase(); - 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 hight, - int32_t& e) = 0; - virtual CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& e) = 0; - - virtual FX_BOOL SetCharEncoding(int32_t 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 void SetBackgroundColor(FX_ARGB backgroundColor); - virtual void SetBarcodeColor(FX_ARGB foregroundColor); - - protected: - CBC_Writer* m_pBCWriter; - CBC_Reader* m_pBCReader; -}; -class CBC_OneCode : public CBC_CodeBase { - public: - CBC_OneCode(); - virtual ~CBC_OneCode(); - 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 hight, - int32_t& e) = 0; - virtual CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& e) = 0; - virtual FX_BOOL CheckContentValidity(const CFX_WideStringC& contents); - virtual CFX_WideString FilterContents(const CFX_WideStringC& contents); - virtual void SetPrintChecksum(FX_BOOL checksum); - virtual void SetDataLength(int32_t length); - virtual void SetCalChecksum(FX_BOOL calc); - virtual FX_BOOL SetFont(CFX_Font* cFont); - virtual void SetFontSize(FX_FLOAT size); - virtual void SetFontStyle(int32_t style); - virtual void SetFontColor(FX_ARGB color); -}; -class CBC_Code39 : public CBC_OneCode { - public: - CBC_Code39(); - CBC_Code39(FX_BOOL usingCheckDigit); - CBC_Code39(FX_BOOL usingCheckDigit, FX_BOOL extendedMode); - virtual ~CBC_Code39(); - 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 hight, int32_t& e); - CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& e); - BC_TYPE GetType() { return BC_CODE39; } - FX_BOOL SetTextLocation(BC_TEXT_LOC location); - FX_BOOL SetWideNarrowRatio(int32_t ratio); - - private: - CFX_WideString m_renderContents; -}; -class CBC_Codabar : public CBC_OneCode { - public: - CBC_Codabar(); - virtual ~CBC_Codabar(); - 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 hight, int32_t& e); - CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& e); - BC_TYPE GetType() { return BC_CODABAR; } - FX_BOOL SetStartChar(FX_CHAR start); - FX_BOOL SetEndChar(FX_CHAR end); - FX_BOOL SetTextLocation(BC_TEXT_LOC location); - FX_BOOL SetWideNarrowRatio(int32_t ratio); - - private: - CFX_WideString m_renderContents; -}; -class CBC_Code128 : public CBC_OneCode { - public: - CBC_Code128(BC_TYPE type); - virtual ~CBC_Code128(); - 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 hight, int32_t& e); - CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& e); - BC_TYPE GetType() { return BC_CODE128; } - FX_BOOL SetTextLocation(BC_TEXT_LOC loction); - - private: - CFX_WideString m_renderContents; -}; -class CBC_EAN8 : public CBC_OneCode { - public: - CBC_EAN8(); - virtual ~CBC_EAN8(); - 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 hight, int32_t& e); - CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& e); - BC_TYPE GetType() { return BC_EAN8; } - - private: - CFX_WideString Preprocess(const CFX_WideStringC& contents); - CFX_WideString m_renderContents; -}; -class CBC_EAN13 : public CBC_OneCode { - public: - CBC_EAN13(); - virtual ~CBC_EAN13(); - 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 hight, int32_t& e); - CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& e); - BC_TYPE GetType() { return BC_EAN13; } - - private: - CFX_WideString Preprocess(const CFX_WideStringC& contents); - CFX_WideString m_renderContents; -}; -class CBC_UPCA : public CBC_OneCode { - public: - CBC_UPCA(); - virtual ~CBC_UPCA(); - 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 hight, int32_t& e); - CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& e); - BC_TYPE GetType() { return BC_UPCA; } - - private: - CFX_WideString Preprocess(const CFX_WideStringC& contents); - CFX_WideString m_renderContents; -}; -class CBC_QRCode : public CBC_CodeBase { - public: - CBC_QRCode(); - virtual ~CBC_QRCode(); - 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 hight, int32_t& e); - CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& e); - BC_TYPE GetType() { return BC_QR_CODE; } - FX_BOOL SetVersion(int32_t version); - FX_BOOL SetErrorCorrectionLevel(int32_t level); -}; -class CBC_PDF417I : public CBC_CodeBase { - public: - CBC_PDF417I(); - virtual ~CBC_PDF417I(); - 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 hight, int32_t& e); - CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& e); - BC_TYPE GetType() { return BC_PDF417; } - FX_BOOL SetErrorCorrectionLevel(int32_t level); - void SetTruncated(FX_BOOL truncated); -}; -class CBC_DataMatrix : public CBC_CodeBase { - public: - CBC_DataMatrix(); - virtual ~CBC_DataMatrix(); - 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 hight, int32_t& e); - CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& e); - BC_TYPE GetType() { return BC_DATAMATRIX; } -}; - -#endif // XFA_INCLUDE_FXBARCODE_BC_BARCODE_H_ |