• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef XFA_FXBARCODE_ONED_BC_ONEDUPCAWRITER_H_
8 #define XFA_FXBARCODE_ONED_BC_ONEDUPCAWRITER_H_
9 
10 #include <memory>
11 
12 #include "core/fxcrt/fx_string.h"
13 #include "core/fxcrt/fx_system.h"
14 #include "xfa/fxbarcode/oned/BC_OneDimWriter.h"
15 
16 class CBC_OnedEAN13Writer;
17 class CFX_DIBitmap;
18 class CFX_Matrix;
19 class CFX_RenderDevice;
20 
21 class CBC_OnedUPCAWriter : public CBC_OneDimWriter {
22  public:
23   CBC_OnedUPCAWriter();
24   ~CBC_OnedUPCAWriter() override;
25 
26   // CBC_OneDimWriter
27   uint8_t* Encode(const CFX_ByteString& contents,
28                   BCFORMAT format,
29                   int32_t& outWidth,
30                   int32_t& outHeight,
31                   int32_t& e) override;
32   uint8_t* Encode(const CFX_ByteString& contents,
33                   BCFORMAT format,
34                   int32_t& outWidth,
35                   int32_t& outHeight,
36                   int32_t hints,
37                   int32_t& e) override;
38   uint8_t* Encode(const CFX_ByteString& contents,
39                   int32_t& outLength,
40                   int32_t& e) override;
41 
42   void RenderResult(const CFX_WideStringC& contents,
43                     uint8_t* code,
44                     int32_t codeLength,
45                     bool isDevice,
46                     int32_t& e) override;
47   bool CheckContentValidity(const CFX_WideStringC& contents) override;
48   CFX_WideString FilterContents(const CFX_WideStringC& contents) override;
49 
50   void Init();
51   int32_t CalcChecksum(const CFX_ByteString& contents);
52 
53  protected:
54   void ShowChars(const CFX_WideStringC& contents,
55                  CFX_DIBitmap* pOutBitmap,
56                  CFX_RenderDevice* device,
57                  const CFX_Matrix* matrix,
58                  int32_t barWidth,
59                  int32_t multiple,
60                  int32_t& e) override;
61 
62  private:
63   std::unique_ptr<CBC_OnedEAN13Writer> m_subWriter;
64 };
65 
66 #endif  // XFA_FXBARCODE_ONED_BC_ONEDUPCAWRITER_H_
67