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> |
(...skipping 22 matching lines...) Expand all Loading... |
33 FWL_BCDATTRIBUTE_WIDENARROWRATIO = 1 << 7, | 33 FWL_BCDATTRIBUTE_WIDENARROWRATIO = 1 << 7, |
34 FWL_BCDATTRIBUTE_STARTCHAR = 1 << 8, | 34 FWL_BCDATTRIBUTE_STARTCHAR = 1 << 8, |
35 FWL_BCDATTRIBUTE_ENDCHAR = 1 << 9, | 35 FWL_BCDATTRIBUTE_ENDCHAR = 1 << 9, |
36 FWL_BCDATTRIBUTE_VERSION = 1 << 10, | 36 FWL_BCDATTRIBUTE_VERSION = 1 << 10, |
37 FWL_BCDATTRIBUTE_ECLEVEL = 1 << 11, | 37 FWL_BCDATTRIBUTE_ECLEVEL = 1 << 11, |
38 FWL_BCDATTRIBUTE_TRUNCATED = 1 << 12 | 38 FWL_BCDATTRIBUTE_TRUNCATED = 1 << 12 |
39 }; | 39 }; |
40 | 40 |
41 class IFWL_Barcode : public IFWL_Edit { | 41 class IFWL_Barcode : public IFWL_Edit { |
42 public: | 42 public: |
43 class DataProvider : public IFWL_Widget::DataProvider { | 43 class DataProvider { |
44 public: | 44 public: |
45 virtual BC_CHAR_ENCODING GetCharEncoding() const = 0; | 45 virtual BC_CHAR_ENCODING GetCharEncoding() const = 0; |
46 virtual int32_t GetModuleHeight() const = 0; | 46 virtual int32_t GetModuleHeight() const = 0; |
47 virtual int32_t GetModuleWidth() const = 0; | 47 virtual int32_t GetModuleWidth() const = 0; |
48 virtual int32_t GetDataLength() const = 0; | 48 virtual int32_t GetDataLength() const = 0; |
49 virtual bool GetCalChecksum() const = 0; | 49 virtual bool GetCalChecksum() const = 0; |
50 virtual bool GetPrintChecksum() const = 0; | 50 virtual bool GetPrintChecksum() const = 0; |
51 virtual BC_TEXT_LOC GetTextLocation() const = 0; | 51 virtual BC_TEXT_LOC GetTextLocation() const = 0; |
52 virtual int32_t GetWideNarrowRatio() const = 0; | 52 virtual int32_t GetWideNarrowRatio() const = 0; |
53 virtual FX_CHAR GetStartChar() const = 0; | 53 virtual FX_CHAR GetStartChar() const = 0; |
(...skipping 14 matching lines...) Expand all Loading... |
68 void DrawWidget(CFX_Graphics* pGraphics, | 68 void DrawWidget(CFX_Graphics* pGraphics, |
69 const CFX_Matrix* pMatrix = nullptr) override; | 69 const CFX_Matrix* pMatrix = nullptr) override; |
70 void OnProcessEvent(CFWL_Event* pEvent) override; | 70 void OnProcessEvent(CFWL_Event* pEvent) override; |
71 | 71 |
72 // IFWL_Edit | 72 // IFWL_Edit |
73 void SetText(const CFX_WideString& wsText) override; | 73 void SetText(const CFX_WideString& wsText) override; |
74 | 74 |
75 void SetType(BC_TYPE type); | 75 void SetType(BC_TYPE type); |
76 bool IsProtectedType() const; | 76 bool IsProtectedType() const; |
77 | 77 |
| 78 void SetDataProvider(IFWL_Barcode::DataProvider* provider) { |
| 79 m_pDataProvider = provider; |
| 80 } |
| 81 |
78 private: | 82 private: |
79 void GenerateBarcodeImageCache(); | 83 void GenerateBarcodeImageCache(); |
80 void CreateBarcodeEngine(); | 84 void CreateBarcodeEngine(); |
81 | 85 |
82 std::unique_ptr<CFX_Barcode> m_pBarcodeEngine; | 86 std::unique_ptr<CFX_Barcode> m_pBarcodeEngine; |
| 87 IFWL_Barcode::DataProvider* m_pDataProvider; // Not owned. |
83 uint32_t m_dwStatus; | 88 uint32_t m_dwStatus; |
84 BC_TYPE m_type; | 89 BC_TYPE m_type; |
85 }; | 90 }; |
86 | 91 |
87 #endif // XFA_FWL_CORE_IFWL_BARCODE_H_ | 92 #endif // XFA_FWL_CORE_IFWL_BARCODE_H_ |
OLD | NEW |