Home | History | Annotate | Download | only in oned
      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_ONEDCODE39WRITER_H_
      8 #define XFA_FXBARCODE_ONED_BC_ONEDCODE39WRITER_H_
      9 
     10 #include "xfa/fxbarcode/BC_Library.h"
     11 #include "xfa/fxbarcode/oned/BC_OneDimWriter.h"
     12 
     13 class CBC_OnedCode39Writer : public CBC_OneDimWriter {
     14  public:
     15   CBC_OnedCode39Writer();
     16   ~CBC_OnedCode39Writer() override;
     17 
     18   // CBC_OneDimWriter
     19   uint8_t* Encode(const CFX_ByteString& contents,
     20                   BCFORMAT format,
     21                   int32_t& outWidth,
     22                   int32_t& outHeight,
     23                   int32_t& e) override;
     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) override;
     30   uint8_t* Encode(const CFX_ByteString& contents,
     31                   int32_t& outLength,
     32                   int32_t& e) override;
     33   void RenderResult(const CFX_WideStringC& contents,
     34                     uint8_t* code,
     35                     int32_t codeLength,
     36                     bool isDevice,
     37                     int32_t& e) override;
     38   bool CheckContentValidity(const CFX_WideStringC& contents) override;
     39   CFX_WideString FilterContents(const CFX_WideStringC& contents) override;
     40   CFX_WideString RenderTextContents(const CFX_WideStringC& contents) override;
     41 
     42   virtual CFX_WideString encodedContents(const CFX_WideStringC& contents,
     43                                          int32_t& e);
     44   virtual bool SetTextLocation(BC_TEXT_LOC loction);
     45   virtual bool SetWideNarrowRatio(int32_t ratio);
     46 
     47  private:
     48   void ToIntArray(int32_t a, int32_t* toReturn);
     49   FX_CHAR CalcCheckSum(const CFX_ByteString& contents, int32_t& e);
     50 
     51   int32_t m_iWideNarrRatio;
     52 };
     53 
     54 #endif  // XFA_FXBARCODE_ONED_BC_ONEDCODE39WRITER_H_
     55