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 FXBARCODE_ONED_BC_ONEDEAN13WRITER_H_
8 #define FXBARCODE_ONED_BC_ONEDEAN13WRITER_H_
9 
10 #include "core/fxcrt/fx_string.h"
11 #include "core/fxcrt/fx_system.h"
12 #include "fxbarcode/oned/BC_OnedEANWriter.h"
13 
14 class CFX_DIBitmap;
15 class CFX_RenderDevice;
16 
17 class CBC_OnedEAN13Writer final : public CBC_OneDimEANWriter {
18  public:
19   CBC_OnedEAN13Writer();
20   ~CBC_OnedEAN13Writer() override;
21 
22   // CBC_OneDimEANWriter:
23   uint8_t* EncodeWithHint(const ByteString& contents,
24                           BCFORMAT format,
25                           int32_t& outWidth,
26                           int32_t& outHeight,
27                           int32_t hints) override;
28   uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) override;
29   bool CheckContentValidity(WideStringView contents) override;
30   WideString FilterContents(WideStringView contents) override;
31   int32_t CalcChecksum(const ByteString& contents) override;
32 
33  private:
34   bool ShowChars(WideStringView contents,
35                  CFX_RenderDevice* device,
36                  const CFX_Matrix* matrix,
37                  int32_t barWidth,
38                  int32_t multiple) override;
39 
40   int32_t m_codeWidth;
41 };
42 
43 #endif  // FXBARCODE_ONED_BC_ONEDEAN13WRITER_H_
44