summaryrefslogtreecommitdiff
path: root/xfa/fwl/core/cfwl_barcode.cpp
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-11-07 10:28:47 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-07 10:28:47 -0800
commiteb3f68cc7f25a1e28464eb251161b8f08fcd04bc (patch)
tree36e565bac1a7760e605b181b7da4c08bda151cdd /xfa/fwl/core/cfwl_barcode.cpp
parenta97fc7c6392c0adbd702bdf898cb9e20cee00a3e (diff)
downloadpdfium-eb3f68cc7f25a1e28464eb251161b8f08fcd04bc.tar.xz
Fold DataProviders into parent classes
This CL removes the data provider classes and folds the code into the parent classes. Review-Url: https://codereview.chromium.org/2480233003
Diffstat (limited to 'xfa/fwl/core/cfwl_barcode.cpp')
-rw-r--r--xfa/fwl/core/cfwl_barcode.cpp107
1 files changed, 59 insertions, 48 deletions
diff --git a/xfa/fwl/core/cfwl_barcode.cpp b/xfa/fwl/core/cfwl_barcode.cpp
index b12a875ee2..77faefed48 100644
--- a/xfa/fwl/core/cfwl_barcode.cpp
+++ b/xfa/fwl/core/cfwl_barcode.cpp
@@ -18,7 +18,8 @@ IFWL_Barcode* ToBarcode(IFWL_Widget* widget) {
} // namespace
-CFWL_Barcode::CFWL_Barcode(const IFWL_App* app) : CFWL_Edit(app) {}
+CFWL_Barcode::CFWL_Barcode(const IFWL_App* app)
+ : CFWL_Edit(app), m_dwAttributeMask(FWL_BCDATTRIBUTE_NONE) {}
CFWL_Barcode::~CFWL_Barcode() {}
@@ -26,66 +27,79 @@ void CFWL_Barcode::Initialize() {
ASSERT(!m_pIface);
m_pIface = pdfium::MakeUnique<IFWL_Barcode>(
- m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(&m_barcodeData));
+ m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(this));
CFWL_Widget::Initialize();
}
void CFWL_Barcode::SetCharEncoding(BC_CHAR_ENCODING encoding) {
- m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_CHARENCODING;
- m_barcodeData.m_eCharEncoding = encoding;
+ m_dwAttributeMask |= FWL_BCDATTRIBUTE_CHARENCODING;
+ m_eCharEncoding = encoding;
}
+
void CFWL_Barcode::SetModuleHeight(int32_t height) {
- m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_MODULEHEIGHT;
- m_barcodeData.m_nModuleHeight = height;
+ m_dwAttributeMask |= FWL_BCDATTRIBUTE_MODULEHEIGHT;
+ m_nModuleHeight = height;
}
+
void CFWL_Barcode::SetModuleWidth(int32_t width) {
- m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_MODULEWIDTH;
- m_barcodeData.m_nModuleWidth = width;
+ m_dwAttributeMask |= FWL_BCDATTRIBUTE_MODULEWIDTH;
+ m_nModuleWidth = width;
}
+
void CFWL_Barcode::SetDataLength(int32_t dataLength) {
- m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_DATALENGTH;
- m_barcodeData.m_nDataLength = dataLength;
+ m_dwAttributeMask |= FWL_BCDATTRIBUTE_DATALENGTH;
+ m_nDataLength = dataLength;
ToBarcode(GetWidget())->SetLimit(dataLength);
}
+
void CFWL_Barcode::SetCalChecksum(bool calChecksum) {
- m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_CALCHECKSUM;
- m_barcodeData.m_bCalChecksum = calChecksum;
+ m_dwAttributeMask |= FWL_BCDATTRIBUTE_CALCHECKSUM;
+ m_bCalChecksum = calChecksum;
}
+
void CFWL_Barcode::SetPrintChecksum(bool printChecksum) {
- m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_PRINTCHECKSUM;
- m_barcodeData.m_bPrintChecksum = printChecksum;
+ m_dwAttributeMask |= FWL_BCDATTRIBUTE_PRINTCHECKSUM;
+ m_bPrintChecksum = printChecksum;
}
+
void CFWL_Barcode::SetTextLocation(BC_TEXT_LOC location) {
- m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_TEXTLOCATION;
- m_barcodeData.m_eTextLocation = location;
+ m_dwAttributeMask |= FWL_BCDATTRIBUTE_TEXTLOCATION;
+ m_eTextLocation = location;
}
+
void CFWL_Barcode::SetWideNarrowRatio(int32_t ratio) {
- m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_WIDENARROWRATIO;
- m_barcodeData.m_nWideNarrowRatio = ratio;
+ m_dwAttributeMask |= FWL_BCDATTRIBUTE_WIDENARROWRATIO;
+ m_nWideNarrowRatio = ratio;
}
+
void CFWL_Barcode::SetStartChar(FX_CHAR startChar) {
- m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_STARTCHAR;
- m_barcodeData.m_cStartChar = startChar;
+ m_dwAttributeMask |= FWL_BCDATTRIBUTE_STARTCHAR;
+ m_cStartChar = startChar;
}
+
void CFWL_Barcode::SetEndChar(FX_CHAR endChar) {
- m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_ENDCHAR;
- m_barcodeData.m_cEndChar = endChar;
+ m_dwAttributeMask |= FWL_BCDATTRIBUTE_ENDCHAR;
+ m_cEndChar = endChar;
}
+
void CFWL_Barcode::SetVersion(int32_t version) {
- m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_VERSION;
- m_barcodeData.m_nVersion = version;
+ m_dwAttributeMask |= FWL_BCDATTRIBUTE_VERSION;
+ m_nVersion = version;
}
+
void CFWL_Barcode::SetErrorCorrectionLevel(int32_t ecLevel) {
- m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_ECLEVEL;
- m_barcodeData.m_nECLevel = ecLevel;
+ m_dwAttributeMask |= FWL_BCDATTRIBUTE_ECLEVEL;
+ m_nECLevel = ecLevel;
}
+
void CFWL_Barcode::SetTruncated(bool truncated) {
- m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_TRUNCATED;
- m_barcodeData.m_bTruncated = truncated;
+ m_dwAttributeMask |= FWL_BCDATTRIBUTE_TRUNCATED;
+ m_bTruncated = truncated;
}
+
void CFWL_Barcode::ResetBarcodeAttributes() {
- m_barcodeData.m_dwAttributeMask = FWL_BCDATTRIBUTE_NONE;
+ m_dwAttributeMask = FWL_BCDATTRIBUTE_NONE;
}
void CFWL_Barcode::SetType(BC_TYPE type) {
@@ -97,66 +111,63 @@ bool CFWL_Barcode::IsProtectedType() {
return GetWidget() ? ToBarcode(GetWidget())->IsProtectedType() : false;
}
-CFWL_Barcode::CFWL_BarcodeDP::CFWL_BarcodeDP()
- : m_dwAttributeMask(FWL_BCDATTRIBUTE_NONE) {}
-
-FWL_Error CFWL_Barcode::CFWL_BarcodeDP::GetCaption(IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) {
+FWL_Error CFWL_Barcode::GetCaption(IFWL_Widget* pWidget,
+ CFX_WideString& wsCaption) {
return FWL_Error::Succeeded;
}
-BC_CHAR_ENCODING CFWL_Barcode::CFWL_BarcodeDP::GetCharEncoding() const {
+BC_CHAR_ENCODING CFWL_Barcode::GetCharEncoding() const {
return m_eCharEncoding;
}
-int32_t CFWL_Barcode::CFWL_BarcodeDP::GetModuleHeight() const {
+int32_t CFWL_Barcode::GetModuleHeight() const {
return m_nModuleHeight;
}
-int32_t CFWL_Barcode::CFWL_BarcodeDP::GetModuleWidth() const {
+int32_t CFWL_Barcode::GetModuleWidth() const {
return m_nModuleWidth;
}
-int32_t CFWL_Barcode::CFWL_BarcodeDP::GetDataLength() const {
+int32_t CFWL_Barcode::GetDataLength() const {
return m_nDataLength;
}
-bool CFWL_Barcode::CFWL_BarcodeDP::GetCalChecksum() const {
+bool CFWL_Barcode::GetCalChecksum() const {
return m_bCalChecksum;
}
-bool CFWL_Barcode::CFWL_BarcodeDP::GetPrintChecksum() const {
+bool CFWL_Barcode::GetPrintChecksum() const {
return m_bPrintChecksum;
}
-BC_TEXT_LOC CFWL_Barcode::CFWL_BarcodeDP::GetTextLocation() const {
+BC_TEXT_LOC CFWL_Barcode::GetTextLocation() const {
return m_eTextLocation;
}
-int32_t CFWL_Barcode::CFWL_BarcodeDP::GetWideNarrowRatio() const {
+int32_t CFWL_Barcode::GetWideNarrowRatio() const {
return m_nWideNarrowRatio;
}
-FX_CHAR CFWL_Barcode::CFWL_BarcodeDP::GetStartChar() const {
+FX_CHAR CFWL_Barcode::GetStartChar() const {
return m_cStartChar;
}
-FX_CHAR CFWL_Barcode::CFWL_BarcodeDP::GetEndChar() const {
+FX_CHAR CFWL_Barcode::GetEndChar() const {
return m_cEndChar;
}
-int32_t CFWL_Barcode::CFWL_BarcodeDP::GetVersion() const {
+int32_t CFWL_Barcode::GetVersion() const {
return m_nVersion;
}
-int32_t CFWL_Barcode::CFWL_BarcodeDP::GetErrorCorrectionLevel() const {
+int32_t CFWL_Barcode::GetErrorCorrectionLevel() const {
return m_nECLevel;
}
-bool CFWL_Barcode::CFWL_BarcodeDP::GetTruncated() const {
+bool CFWL_Barcode::GetTruncated() const {
return m_bTruncated;
}
-uint32_t CFWL_Barcode::CFWL_BarcodeDP::GetBarcodeAttributeMask() const {
+uint32_t CFWL_Barcode::GetBarcodeAttributeMask() const {
return m_dwAttributeMask;
}