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 _BC_ONEDCODABARWRITER_H_
8 #define _BC_ONEDCODABARWRITER_H_
9 enum BC_TEXT_LOC;
10 class CBC_OneDimWriter;
11 class CBC_OnedCodaBarWriter;
12 class CBC_OnedCodaBarWriter : public CBC_OneDimWriter {
13  public:
14   CBC_OnedCodaBarWriter();
15   virtual ~CBC_OnedCodaBarWriter();
16   uint8_t* Encode(const CFX_ByteString& contents,
17                   int32_t& outLength,
18                   int32_t& e);
19   uint8_t* Encode(const CFX_ByteString& contents,
20                   BCFORMAT format,
21                   int32_t& outWidth,
22                   int32_t& outHeight,
23                   int32_t& e);
24   uint8_t* Encode(const CFX_ByteString& contents,
25                   BCFORMAT format,
26                   int32_t& outWidth,
27                   int32_t& outHeight,
28                   int32_t hints,
29                   int32_t& e);
30   CFX_WideString encodedContents(const CFX_WideStringC& contents);
31   FX_BOOL CheckContentValidity(const CFX_WideStringC& contents);
32   CFX_WideString FilterContents(const CFX_WideStringC& contents);
33   FX_BOOL SetStartChar(FX_CHAR start);
34   FX_BOOL SetEndChar(FX_CHAR end);
35   void SetDataLength(int32_t length);
36   FX_BOOL SetTextLocation(BC_TEXT_LOC location);
37   FX_BOOL SetWideNarrowRatio(int32_t ratio);
38   FX_BOOL FindChar(FX_WCHAR ch, FX_BOOL isContent);
39 
40  private:
41   void RenderResult(const CFX_WideStringC& contents,
42                     uint8_t* code,
43                     int32_t codeLength,
44                     FX_BOOL isDevice,
45                     int32_t& e);
46   const static FX_CHAR START_END_CHARS[];
47   const static FX_CHAR CONTENT_CHARS[];
48   FX_CHAR m_chStart;
49   FX_CHAR m_chEnd;
50   int32_t m_iWideNarrRatio;
51 };
52 #endif
53