summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fxbarcode/cbc_codabar.h11
-rw-r--r--fxbarcode/cbc_code128.h5
-rw-r--r--fxbarcode/cbc_code39.h7
-rw-r--r--fxbarcode/cbc_codebase.cpp20
-rw-r--r--fxbarcode/cbc_codebase.h5
-rw-r--r--fxbarcode/cbc_pdf417i.h3
-rw-r--r--fxbarcode/cbc_qrcode.h3
-rw-r--r--fxbarcode/oned/BC_OnedCode39Writer.h2
-rw-r--r--xfa/fwl/cfx_barcode.cpp69
9 files changed, 43 insertions, 82 deletions
diff --git a/fxbarcode/cbc_codabar.h b/fxbarcode/cbc_codabar.h
index 036c65f829..7fc518b80f 100644
--- a/fxbarcode/cbc_codabar.h
+++ b/fxbarcode/cbc_codabar.h
@@ -20,15 +20,14 @@ class CBC_Codabar final : public CBC_OneCode {
~CBC_Codabar() override;
// CBC_OneCode:
+ BC_TYPE GetType() override;
bool Encode(const WideStringView& contents) override;
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) override;
- BC_TYPE GetType() override;
-
- bool SetStartChar(char start);
- bool SetEndChar(char end);
- bool SetTextLocation(BC_TEXT_LOC location);
- bool SetWideNarrowRatio(int8_t ratio);
+ bool SetTextLocation(BC_TEXT_LOC location) override;
+ bool SetWideNarrowRatio(int8_t ratio) override;
+ bool SetStartChar(char start) override;
+ bool SetEndChar(char end) override;
private:
CBC_OnedCodaBarWriter* GetOnedCodaBarWriter();
diff --git a/fxbarcode/cbc_code128.h b/fxbarcode/cbc_code128.h
index 61bed6fe0f..ccd5a38243 100644
--- a/fxbarcode/cbc_code128.h
+++ b/fxbarcode/cbc_code128.h
@@ -20,12 +20,11 @@ class CBC_Code128 final : public CBC_OneCode {
~CBC_Code128() override;
// CBC_OneCode:
+ BC_TYPE GetType() override;
bool Encode(const WideStringView& contents) override;
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) override;
- BC_TYPE GetType() override;
-
- bool SetTextLocation(BC_TEXT_LOC loction);
+ bool SetTextLocation(BC_TEXT_LOC location) override;
private:
CBC_OnedCode128Writer* GetOnedCode128Writer();
diff --git a/fxbarcode/cbc_code39.h b/fxbarcode/cbc_code39.h
index 83c8daa32f..4e240b7f89 100644
--- a/fxbarcode/cbc_code39.h
+++ b/fxbarcode/cbc_code39.h
@@ -21,13 +21,12 @@ class CBC_Code39 final : public CBC_OneCode {
~CBC_Code39() override;
// CBC_OneCode:
+ BC_TYPE GetType() override;
bool Encode(const WideStringView& contents) override;
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) override;
- BC_TYPE GetType() override;
-
- bool SetTextLocation(BC_TEXT_LOC location);
- bool SetWideNarrowRatio(int8_t ratio);
+ bool SetTextLocation(BC_TEXT_LOC location) override;
+ bool SetWideNarrowRatio(int8_t ratio) override;
private:
CBC_OnedCode39Writer* GetOnedCode39Writer();
diff --git a/fxbarcode/cbc_codebase.cpp b/fxbarcode/cbc_codebase.cpp
index 2278f931e8..b723f551d5 100644
--- a/fxbarcode/cbc_codebase.cpp
+++ b/fxbarcode/cbc_codebase.cpp
@@ -30,6 +30,26 @@ CBC_CodeBase::CBC_CodeBase(std::unique_ptr<CBC_Writer> pWriter)
CBC_CodeBase::~CBC_CodeBase() {}
+bool CBC_CodeBase::SetTextLocation(BC_TEXT_LOC location) {
+ return false;
+}
+
+bool CBC_CodeBase::SetWideNarrowRatio(int8_t ratio) {
+ return false;
+}
+
+bool CBC_CodeBase::SetStartChar(char start) {
+ return false;
+}
+
+bool CBC_CodeBase::SetEndChar(char end) {
+ return false;
+}
+
+bool CBC_CodeBase::SetErrorCorrectionLevel(int32_t level) {
+ return false;
+}
+
bool CBC_CodeBase::SetCharEncoding(int32_t encoding) {
return m_pBCWriter->SetCharEncoding(encoding);
}
diff --git a/fxbarcode/cbc_codebase.h b/fxbarcode/cbc_codebase.h
index aab98da32b..e0f402d91c 100644
--- a/fxbarcode/cbc_codebase.h
+++ b/fxbarcode/cbc_codebase.h
@@ -29,6 +29,11 @@ class CBC_CodeBase {
virtual bool Encode(const WideStringView& contents) = 0;
virtual bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) = 0;
+ virtual bool SetTextLocation(BC_TEXT_LOC location);
+ virtual bool SetWideNarrowRatio(int8_t ratio);
+ virtual bool SetStartChar(char start);
+ virtual bool SetEndChar(char end);
+ virtual bool SetErrorCorrectionLevel(int32_t level);
bool SetCharEncoding(int32_t encoding);
bool SetModuleHeight(int32_t moduleHeight);
diff --git a/fxbarcode/cbc_pdf417i.h b/fxbarcode/cbc_pdf417i.h
index ec686006cb..b12fa74c60 100644
--- a/fxbarcode/cbc_pdf417i.h
+++ b/fxbarcode/cbc_pdf417i.h
@@ -24,8 +24,7 @@ class CBC_PDF417I final : public CBC_CodeBase {
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) override;
BC_TYPE GetType() override;
-
- bool SetErrorCorrectionLevel(int32_t level);
+ bool SetErrorCorrectionLevel(int32_t level) override;
private:
CBC_PDF417Writer* GetPDF417Writer();
diff --git a/fxbarcode/cbc_qrcode.h b/fxbarcode/cbc_qrcode.h
index 59d57ac648..8502933df5 100644
--- a/fxbarcode/cbc_qrcode.h
+++ b/fxbarcode/cbc_qrcode.h
@@ -24,8 +24,7 @@ class CBC_QRCode final : public CBC_CodeBase {
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) override;
BC_TYPE GetType() override;
-
- bool SetErrorCorrectionLevel(int32_t level);
+ bool SetErrorCorrectionLevel(int32_t level) override;
private:
CBC_QRCodeWriter* GetQRCodeWriter();
diff --git a/fxbarcode/oned/BC_OnedCode39Writer.h b/fxbarcode/oned/BC_OnedCode39Writer.h
index 0791062660..97ef7a22b5 100644
--- a/fxbarcode/oned/BC_OnedCode39Writer.h
+++ b/fxbarcode/oned/BC_OnedCode39Writer.h
@@ -29,7 +29,7 @@ class CBC_OnedCode39Writer final : public CBC_OneDimWriter {
WideString FilterContents(const WideStringView& contents) override;
WideString RenderTextContents(const WideStringView& contents) override;
- virtual bool SetTextLocation(BC_TEXT_LOC loction);
+ virtual bool SetTextLocation(BC_TEXT_LOC location);
virtual bool SetWideNarrowRatio(int8_t ratio);
bool encodedContents(const WideStringView& contents, WideString* result);
diff --git a/xfa/fwl/cfx_barcode.cpp b/xfa/fwl/cfx_barcode.cpp
index 583fa9ce56..1d13062a97 100644
--- a/xfa/fwl/cfx_barcode.cpp
+++ b/xfa/fwl/cfx_barcode.cpp
@@ -204,82 +204,23 @@ bool CFX_Barcode::SetFontColor(FX_ARGB color) {
}
bool CFX_Barcode::SetTextLocation(BC_TEXT_LOC location) {
- typedef bool (CBC_CodeBase::*memptrtype)(BC_TEXT_LOC);
- memptrtype memptr = nullptr;
- switch (GetType()) {
- case BC_CODE39:
- memptr = (memptrtype)&CBC_Code39::SetTextLocation;
- break;
- case BC_CODABAR:
- memptr = (memptrtype)&CBC_Codabar::SetTextLocation;
- break;
- case BC_CODE128:
- case BC_CODE128_B:
- case BC_CODE128_C:
- memptr = (memptrtype)&CBC_Code128::SetTextLocation;
- break;
- default:
- break;
- }
- return m_pBCEngine && memptr ? (m_pBCEngine.get()->*memptr)(location) : false;
+ return m_pBCEngine && m_pBCEngine->SetTextLocation(location);
}
bool CFX_Barcode::SetWideNarrowRatio(int8_t ratio) {
- typedef bool (CBC_CodeBase::*memptrtype)(int8_t);
- memptrtype memptr = nullptr;
- switch (GetType()) {
- case BC_CODE39:
- memptr = (memptrtype)&CBC_Code39::SetWideNarrowRatio;
- break;
- case BC_CODABAR:
- memptr = (memptrtype)&CBC_Codabar::SetWideNarrowRatio;
- break;
- default:
- break;
- }
- return m_pBCEngine && memptr ? (m_pBCEngine.get()->*memptr)(ratio) : false;
+ return m_pBCEngine && m_pBCEngine->SetWideNarrowRatio(ratio);
}
bool CFX_Barcode::SetStartChar(char start) {
- typedef bool (CBC_CodeBase::*memptrtype)(char);
- memptrtype memptr = nullptr;
- switch (GetType()) {
- case BC_CODABAR:
- memptr = (memptrtype)&CBC_Codabar::SetStartChar;
- break;
- default:
- break;
- }
- return m_pBCEngine && memptr ? (m_pBCEngine.get()->*memptr)(start) : false;
+ return m_pBCEngine && m_pBCEngine->SetStartChar(start);
}
bool CFX_Barcode::SetEndChar(char end) {
- typedef bool (CBC_CodeBase::*memptrtype)(char);
- memptrtype memptr = nullptr;
- switch (GetType()) {
- case BC_CODABAR:
- memptr = (memptrtype)&CBC_Codabar::SetEndChar;
- break;
- default:
- break;
- }
- return m_pBCEngine && memptr ? (m_pBCEngine.get()->*memptr)(end) : false;
+ return m_pBCEngine && m_pBCEngine->SetEndChar(end);
}
bool CFX_Barcode::SetErrorCorrectionLevel(int32_t level) {
- typedef bool (CBC_CodeBase::*memptrtype)(int32_t);
- memptrtype memptr = nullptr;
- switch (GetType()) {
- case BC_QR_CODE:
- memptr = (memptrtype)&CBC_QRCode::SetErrorCorrectionLevel;
- break;
- case BC_PDF417:
- memptr = (memptrtype)&CBC_PDF417I::SetErrorCorrectionLevel;
- break;
- default:
- return false;
- }
- return m_pBCEngine && memptr ? (m_pBCEngine.get()->*memptr)(level) : false;
+ return m_pBCEngine && m_pBCEngine->SetErrorCorrectionLevel(level);
}
bool CFX_Barcode::Encode(const WideStringView& contents) {