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_ONEDCODABARWRITER_H_ 8 #define XFA_FXBARCODE_ONED_BC_ONEDCODABARWRITER_H_ 9 10 #include "core/fxcrt/fx_string.h" 11 #include "core/fxcrt/fx_system.h" 12 #include "xfa/fxbarcode/BC_Library.h" 13 #include "xfa/fxbarcode/oned/BC_OneDimWriter.h" 14 15 class CBC_OnedCodaBarWriter : public CBC_OneDimWriter { 16 public: 17 CBC_OnedCodaBarWriter(); 18 ~CBC_OnedCodaBarWriter() override; 19 20 // CBC_OneDimWriter 21 uint8_t* Encode(const CFX_ByteString& contents, 22 int32_t& outLength, 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& e) override; 29 uint8_t* Encode(const CFX_ByteString& contents, 30 BCFORMAT format, 31 int32_t& outWidth, 32 int32_t& outHeight, 33 int32_t hints, 34 int32_t& e) override; 35 bool CheckContentValidity(const CFX_WideStringC& contents) override; 36 CFX_WideString FilterContents(const CFX_WideStringC& contents) override; 37 void SetDataLength(int32_t length) override; 38 39 virtual CFX_WideString encodedContents(const CFX_WideStringC& contents); 40 virtual bool SetStartChar(FX_CHAR start); 41 virtual bool SetEndChar(FX_CHAR end); 42 virtual bool SetTextLocation(BC_TEXT_LOC location); 43 virtual bool SetWideNarrowRatio(int32_t ratio); 44 virtual bool FindChar(FX_WCHAR ch, bool isContent); 45 46 private: 47 void RenderResult(const CFX_WideStringC& contents, 48 uint8_t* code, 49 int32_t codeLength, 50 bool isDevice, 51 int32_t& e) override; 52 53 FX_CHAR m_chStart; 54 FX_CHAR m_chEnd; 55 int32_t m_iWideNarrRatio; 56 }; 57 58 #endif // XFA_FXBARCODE_ONED_BC_ONEDCODABARWRITER_H_ 59