blob: fb8cb05ef87704ca1077d5773a11765f3e4253d0 [file] [log] [blame]
Dan Sinclaira98600a2016-03-21 15:15:56 -04001// Copyright 2016 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 * Copyright 2011 ZXing authors
8 *
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 */
21
Dan Sinclaire7786682017-03-29 15:18:41 -040022#include "fxbarcode/cbc_onecode.h"
Dan Sinclaira98600a2016-03-21 15:15:56 -040023
Tom Sepezea23e0a2017-05-01 14:24:19 -070024#include <utility>
25
Dan Sinclaire7786682017-03-29 15:18:41 -040026#include "fxbarcode/oned/BC_OneDimWriter.h"
Dan Sinclaira98600a2016-03-21 15:15:56 -040027
Tom Sepezea23e0a2017-05-01 14:24:19 -070028CBC_OneCode::CBC_OneCode(std::unique_ptr<CBC_Writer> pWriter)
29 : CBC_CodeBase(std::move(pWriter)) {}
Dan Sinclaira98600a2016-03-21 15:15:56 -040030
31CBC_OneCode::~CBC_OneCode() {}
32
Ryan Harrison275e2602017-09-18 14:23:18 -040033bool CBC_OneCode::CheckContentValidity(const WideStringView& contents) {
Lei Zhang1badb852017-04-20 15:58:56 -070034 return GetOneDimWriter()->CheckContentValidity(contents);
Dan Sinclaira98600a2016-03-21 15:15:56 -040035}
36
Ryan Harrison275e2602017-09-18 14:23:18 -040037WideString CBC_OneCode::FilterContents(const WideStringView& contents) {
Lei Zhang1badb852017-04-20 15:58:56 -070038 return GetOneDimWriter()->FilterContents(contents);
Dan Sinclaira98600a2016-03-21 15:15:56 -040039}
40
tsepezd19e9122016-11-02 15:43:18 -070041void CBC_OneCode::SetPrintChecksum(bool checksum) {
Lei Zhang1badb852017-04-20 15:58:56 -070042 GetOneDimWriter()->SetPrintChecksum(checksum);
Dan Sinclaira98600a2016-03-21 15:15:56 -040043}
44
45void CBC_OneCode::SetDataLength(int32_t length) {
Lei Zhang1badb852017-04-20 15:58:56 -070046 GetOneDimWriter()->SetDataLength(length);
Dan Sinclaira98600a2016-03-21 15:15:56 -040047}
48
tsepezd19e9122016-11-02 15:43:18 -070049void CBC_OneCode::SetCalChecksum(bool calc) {
Lei Zhang1badb852017-04-20 15:58:56 -070050 GetOneDimWriter()->SetCalcChecksum(calc);
Dan Sinclaira98600a2016-03-21 15:15:56 -040051}
52
tsepezd19e9122016-11-02 15:43:18 -070053bool CBC_OneCode::SetFont(CFX_Font* cFont) {
Lei Zhang1badb852017-04-20 15:58:56 -070054 return GetOneDimWriter()->SetFont(cFont);
Dan Sinclaira98600a2016-03-21 15:15:56 -040055}
56
Dan Sinclair05df0752017-03-14 14:43:42 -040057void CBC_OneCode::SetFontSize(float size) {
Lei Zhang1badb852017-04-20 15:58:56 -070058 GetOneDimWriter()->SetFontSize(size);
Dan Sinclaira98600a2016-03-21 15:15:56 -040059}
60
61void CBC_OneCode::SetFontStyle(int32_t style) {
Lei Zhang1badb852017-04-20 15:58:56 -070062 GetOneDimWriter()->SetFontStyle(style);
Dan Sinclaira98600a2016-03-21 15:15:56 -040063}
64
65void CBC_OneCode::SetFontColor(FX_ARGB color) {
Lei Zhang1badb852017-04-20 15:58:56 -070066 GetOneDimWriter()->SetFontColor(color);
67}
68
69CBC_OneDimWriter* CBC_OneCode::GetOneDimWriter() {
70 return static_cast<CBC_OneDimWriter*>(m_pBCWriter.get());
Dan Sinclaira98600a2016-03-21 15:15:56 -040071}