| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef XFA_FWL_CORE_IFWL_BARCODE_H_ | 7 #ifndef XFA_FWL_CORE_IFWL_BARCODE_H_ |
| 8 #define XFA_FWL_CORE_IFWL_BARCODE_H_ | 8 #define XFA_FWL_CORE_IFWL_BARCODE_H_ |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "xfa/fwl/core/ifwl_edit.h" | 12 #include "xfa/fwl/core/ifwl_edit.h" |
| 13 #include "xfa/fwl/core/ifwl_scrollbar.h" | 13 #include "xfa/fwl/core/ifwl_scrollbar.h" |
| 14 #include "xfa/fxbarcode/BC_Library.h" | 14 #include "xfa/fxbarcode/BC_Library.h" |
| 15 | 15 |
| 16 class CFWL_BarcodeImpDelegate; | 16 class CFWL_BarcodeImpDelegate; |
| 17 class CFWL_WidgetImpProperties; | 17 class CFWL_WidgetImpProperties; |
| 18 class CFX_Barcode; | 18 class CFX_Barcode; |
| 19 class IFWL_Widget; | 19 class IFWL_Widget; |
| 20 | 20 |
| 21 #define XFA_BCS_NeedUpdate 0x0001 | 21 #define XFA_BCS_NeedUpdate 0x0001 |
| 22 #define XFA_BCS_EncodeSuccess 0x0002 | 22 #define XFA_BCS_EncodeSuccess 0x0002 |
| 23 #define FWL_CLASS_Barcode L"FWL_BARCODE" | |
| 24 | 23 |
| 25 enum FWL_BCDAttribute { | 24 enum FWL_BCDAttribute { |
| 26 FWL_BCDATTRIBUTE_NONE = 0, | 25 FWL_BCDATTRIBUTE_NONE = 0, |
| 27 FWL_BCDATTRIBUTE_CHARENCODING = 1 << 0, | 26 FWL_BCDATTRIBUTE_CHARENCODING = 1 << 0, |
| 28 FWL_BCDATTRIBUTE_MODULEHEIGHT = 1 << 1, | 27 FWL_BCDATTRIBUTE_MODULEHEIGHT = 1 << 1, |
| 29 FWL_BCDATTRIBUTE_MODULEWIDTH = 1 << 2, | 28 FWL_BCDATTRIBUTE_MODULEWIDTH = 1 << 2, |
| 30 FWL_BCDATTRIBUTE_DATALENGTH = 1 << 3, | 29 FWL_BCDATTRIBUTE_DATALENGTH = 1 << 3, |
| 31 FWL_BCDATTRIBUTE_CALCHECKSUM = 1 << 4, | 30 FWL_BCDATTRIBUTE_CALCHECKSUM = 1 << 4, |
| 32 FWL_BCDATTRIBUTE_PRINTCHECKSUM = 1 << 5, | 31 FWL_BCDATTRIBUTE_PRINTCHECKSUM = 1 << 5, |
| 33 FWL_BCDATTRIBUTE_TEXTLOCATION = 1 << 6, | 32 FWL_BCDATTRIBUTE_TEXTLOCATION = 1 << 6, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 56 virtual FX_BOOL GetTruncated() = 0; | 55 virtual FX_BOOL GetTruncated() = 0; |
| 57 virtual uint32_t GetBarcodeAttributeMask() = 0; | 56 virtual uint32_t GetBarcodeAttributeMask() = 0; |
| 58 }; | 57 }; |
| 59 | 58 |
| 60 class IFWL_Barcode : public IFWL_Edit { | 59 class IFWL_Barcode : public IFWL_Edit { |
| 61 public: | 60 public: |
| 62 explicit IFWL_Barcode(const CFWL_WidgetImpProperties& properties); | 61 explicit IFWL_Barcode(const CFWL_WidgetImpProperties& properties); |
| 63 ~IFWL_Barcode() override; | 62 ~IFWL_Barcode() override; |
| 64 | 63 |
| 65 // IFWL_Widget | 64 // IFWL_Widget |
| 66 FWL_Error GetClassName(CFX_WideString& wsClass) const override; | |
| 67 FWL_Type GetClassID() const override; | 65 FWL_Type GetClassID() const override; |
| 68 FWL_Error Initialize() override; | 66 FWL_Error Initialize() override; |
| 69 FWL_Error Finalize() override; | 67 void Finalize() override; |
| 70 FWL_Error Update() override; | 68 FWL_Error Update() override; |
| 71 FWL_Error DrawWidget(CFX_Graphics* pGraphics, | 69 FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
| 72 const CFX_Matrix* pMatrix = nullptr) override; | 70 const CFX_Matrix* pMatrix = nullptr) override; |
| 73 FWL_Error SetText(const CFX_WideString& wsText) override; | 71 FWL_Error SetText(const CFX_WideString& wsText) override; |
| 74 | 72 |
| 75 void SetType(BC_TYPE type); | 73 void SetType(BC_TYPE type); |
| 76 FX_BOOL IsProtectedType(); | 74 FX_BOOL IsProtectedType(); |
| 77 | 75 |
| 78 protected: | 76 protected: |
| 79 friend class CFWL_BarcodeImpDelegate; | 77 friend class CFWL_BarcodeImpDelegate; |
| 80 | 78 |
| 81 void GenerateBarcodeImageCache(); | 79 void GenerateBarcodeImageCache(); |
| 82 void CreateBarcodeEngine(); | 80 void CreateBarcodeEngine(); |
| 83 | 81 |
| 84 std::unique_ptr<CFX_Barcode> m_pBarcodeEngine; | 82 std::unique_ptr<CFX_Barcode> m_pBarcodeEngine; |
| 85 uint32_t m_dwStatus; | 83 uint32_t m_dwStatus; |
| 86 BC_TYPE m_type; | 84 BC_TYPE m_type; |
| 87 }; | 85 }; |
| 88 | 86 |
| 89 class CFWL_BarcodeImpDelegate : public CFWL_EditImpDelegate { | 87 class CFWL_BarcodeImpDelegate : public CFWL_EditImpDelegate { |
| 90 public: | 88 public: |
| 91 explicit CFWL_BarcodeImpDelegate(IFWL_Barcode* pOwner); | 89 explicit CFWL_BarcodeImpDelegate(IFWL_Barcode* pOwner); |
| 92 void OnProcessEvent(CFWL_Event* pEvent) override; | 90 void OnProcessEvent(CFWL_Event* pEvent) override; |
| 93 }; | 91 }; |
| 94 | 92 |
| 95 #endif // XFA_FWL_CORE_IFWL_BARCODE_H_ | 93 #endif // XFA_FWL_CORE_IFWL_BARCODE_H_ |
| OLD | NEW |