diff options
Diffstat (limited to 'xfa/fwl/basewidget')
-rw-r--r-- | xfa/fwl/basewidget/cfx_barcode.cpp | 71 | ||||
-rw-r--r-- | xfa/fwl/basewidget/cfx_barcode.h | 4 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_caretimp.cpp | 6 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_caretimp.h | 6 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_editimp.cpp | 13 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_editimp.h | 2 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_monthcalendarimp.cpp | 9 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_monthcalendarimp.h | 4 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp | 8 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_tooltipctrlimp.h | 1 |
10 files changed, 56 insertions, 68 deletions
diff --git a/xfa/fwl/basewidget/cfx_barcode.cpp b/xfa/fwl/basewidget/cfx_barcode.cpp index 723619fc5f..cb554f5c5b 100644 --- a/xfa/fwl/basewidget/cfx_barcode.cpp +++ b/xfa/fwl/basewidget/cfx_barcode.cpp @@ -54,12 +54,10 @@ CBC_CodeBase* CreateBarCodeEngineObject(BC_TYPE type) { CFX_Barcode::CFX_Barcode() {} -CFX_Barcode::~CFX_Barcode() { - delete m_pBCEngine; -} +CFX_Barcode::~CFX_Barcode() {} FX_BOOL CFX_Barcode::Create(BC_TYPE type) { - m_pBCEngine = CreateBarCodeEngineObject(type); + m_pBCEngine.reset(CreateBarCodeEngineObject(type)); return !!m_pBCEngine; } BC_TYPE CFX_Barcode::GetType() { @@ -91,7 +89,7 @@ FX_BOOL CFX_Barcode::CheckContentValidity(const CFX_WideStringC& contents) { case BC_EAN13: case BC_UPCA: return m_pBCEngine - ? static_cast<CBC_OneCode*>(m_pBCEngine) + ? static_cast<CBC_OneCode*>(m_pBCEngine.get()) ->CheckContentValidity(contents) : TRUE; default: @@ -108,7 +106,7 @@ FX_BOOL CFX_Barcode::SetPrintChecksum(FX_BOOL checksum) { case BC_EAN8: case BC_EAN13: case BC_UPCA: - return m_pBCEngine ? (static_cast<CBC_OneCode*>(m_pBCEngine) + return m_pBCEngine ? (static_cast<CBC_OneCode*>(m_pBCEngine.get()) ->SetPrintChecksum(checksum), TRUE) : FALSE; @@ -126,7 +124,7 @@ FX_BOOL CFX_Barcode::SetDataLength(int32_t length) { case BC_EAN8: case BC_EAN13: case BC_UPCA: - return m_pBCEngine ? (static_cast<CBC_OneCode*>(m_pBCEngine) + return m_pBCEngine ? (static_cast<CBC_OneCode*>(m_pBCEngine.get()) ->SetDataLength(length), TRUE) : FALSE; @@ -144,7 +142,7 @@ FX_BOOL CFX_Barcode::SetCalChecksum(int32_t state) { case BC_EAN8: case BC_EAN13: case BC_UPCA: - return m_pBCEngine ? (static_cast<CBC_OneCode*>(m_pBCEngine) + return m_pBCEngine ? (static_cast<CBC_OneCode*>(m_pBCEngine.get()) ->SetCalChecksum(state), TRUE) : FALSE; @@ -163,7 +161,7 @@ FX_BOOL CFX_Barcode::SetFont(CFX_Font* pFont) { case BC_EAN13: case BC_UPCA: return m_pBCEngine - ? static_cast<CBC_OneCode*>(m_pBCEngine)->SetFont(pFont) + ? static_cast<CBC_OneCode*>(m_pBCEngine.get())->SetFont(pFont) : FALSE; default: return FALSE; @@ -179,10 +177,10 @@ FX_BOOL CFX_Barcode::SetFontSize(FX_FLOAT size) { case BC_EAN8: case BC_EAN13: case BC_UPCA: - return m_pBCEngine - ? (static_cast<CBC_OneCode*>(m_pBCEngine)->SetFontSize(size), - TRUE) - : FALSE; + return m_pBCEngine ? (static_cast<CBC_OneCode*>(m_pBCEngine.get()) + ->SetFontSize(size), + TRUE) + : FALSE; default: return FALSE; } @@ -197,10 +195,10 @@ FX_BOOL CFX_Barcode::SetFontStyle(int32_t style) { case BC_EAN8: case BC_EAN13: case BC_UPCA: - return m_pBCEngine - ? (static_cast<CBC_OneCode*>(m_pBCEngine)->SetFontStyle(style), - TRUE) - : FALSE; + return m_pBCEngine ? (static_cast<CBC_OneCode*>(m_pBCEngine.get()) + ->SetFontStyle(style), + TRUE) + : FALSE; default: return FALSE; } @@ -215,10 +213,10 @@ FX_BOOL CFX_Barcode::SetFontColor(FX_ARGB color) { case BC_EAN8: case BC_EAN13: case BC_UPCA: - return m_pBCEngine - ? (static_cast<CBC_OneCode*>(m_pBCEngine)->SetFontColor(color), - TRUE) - : FALSE; + return m_pBCEngine ? (static_cast<CBC_OneCode*>(m_pBCEngine.get()) + ->SetFontColor(color), + TRUE) + : FALSE; default: return FALSE; } @@ -241,7 +239,7 @@ FX_BOOL CFX_Barcode::SetTextLocation(BC_TEXT_LOC location) { default: break; } - return m_pBCEngine && memptr ? (m_pBCEngine->*memptr)(location) : FALSE; + return m_pBCEngine && memptr ? (m_pBCEngine.get()->*memptr)(location) : FALSE; } FX_BOOL CFX_Barcode::SetWideNarrowRatio(int32_t ratio) { typedef FX_BOOL (CBC_CodeBase::*memptrtype)(int32_t); @@ -256,7 +254,7 @@ FX_BOOL CFX_Barcode::SetWideNarrowRatio(int32_t ratio) { default: break; } - return m_pBCEngine && memptr ? (m_pBCEngine->*memptr)(ratio) : FALSE; + return m_pBCEngine && memptr ? (m_pBCEngine.get()->*memptr)(ratio) : FALSE; } FX_BOOL CFX_Barcode::SetStartChar(FX_CHAR start) { typedef FX_BOOL (CBC_CodeBase::*memptrtype)(FX_CHAR); @@ -268,7 +266,7 @@ FX_BOOL CFX_Barcode::SetStartChar(FX_CHAR start) { default: break; } - return m_pBCEngine && memptr ? (m_pBCEngine->*memptr)(start) : FALSE; + return m_pBCEngine && memptr ? (m_pBCEngine.get()->*memptr)(start) : FALSE; } FX_BOOL CFX_Barcode::SetEndChar(FX_CHAR end) { typedef FX_BOOL (CBC_CodeBase::*memptrtype)(FX_CHAR); @@ -280,7 +278,7 @@ FX_BOOL CFX_Barcode::SetEndChar(FX_CHAR end) { default: break; } - return m_pBCEngine && memptr ? (m_pBCEngine->*memptr)(end) : FALSE; + return m_pBCEngine && memptr ? (m_pBCEngine.get()->*memptr)(end) : FALSE; } FX_BOOL CFX_Barcode::SetVersion(int32_t version) { typedef FX_BOOL (CBC_CodeBase::*memptrtype)(int32_t); @@ -292,7 +290,7 @@ FX_BOOL CFX_Barcode::SetVersion(int32_t version) { default: break; } - return m_pBCEngine && memptr ? (m_pBCEngine->*memptr)(version) : FALSE; + return m_pBCEngine && memptr ? (m_pBCEngine.get()->*memptr)(version) : FALSE; } FX_BOOL CFX_Barcode::SetErrorCorrectionLevel(int32_t level) { typedef FX_BOOL (CBC_CodeBase::*memptrtype)(int32_t); @@ -307,7 +305,7 @@ FX_BOOL CFX_Barcode::SetErrorCorrectionLevel(int32_t level) { default: return FALSE; } - return m_pBCEngine && memptr ? (m_pBCEngine->*memptr)(level) : FALSE; + return m_pBCEngine && memptr ? (m_pBCEngine.get()->*memptr)(level) : FALSE; } FX_BOOL CFX_Barcode::SetTruncated(FX_BOOL truncated) { typedef void (CBC_CodeBase::*memptrtype)(FX_BOOL); @@ -319,29 +317,22 @@ FX_BOOL CFX_Barcode::SetTruncated(FX_BOOL truncated) { default: break; } - return m_pBCEngine && memptr ? ((m_pBCEngine->*memptr)(truncated), TRUE) + return m_pBCEngine && memptr ? ((m_pBCEngine.get()->*memptr)(truncated), TRUE) : FALSE; } FX_BOOL CFX_Barcode::Encode(const CFX_WideStringC& contents, FX_BOOL isDevice, int32_t& e) { - if (!m_pBCEngine) { - return FALSE; - } - return m_pBCEngine->Encode(contents, isDevice, e); + return m_pBCEngine && m_pBCEngine->Encode(contents, isDevice, e); } + FX_BOOL CFX_Barcode::RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matrix, int32_t& e) { - if (!m_pBCEngine) { - return FALSE; - } - return m_pBCEngine->RenderDevice(device, matrix, e); + return m_pBCEngine && m_pBCEngine->RenderDevice(device, matrix, e); } + FX_BOOL CFX_Barcode::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) { - if (!m_pBCEngine) { - return FALSE; - } - return m_pBCEngine->RenderBitmap(pOutBitmap, e); + return m_pBCEngine && m_pBCEngine->RenderBitmap(pOutBitmap, e); } diff --git a/xfa/fwl/basewidget/cfx_barcode.h b/xfa/fwl/basewidget/cfx_barcode.h index 2ba1f7f77d..758ba20b1a 100644 --- a/xfa/fwl/basewidget/cfx_barcode.h +++ b/xfa/fwl/basewidget/cfx_barcode.h @@ -7,6 +7,8 @@ #ifndef XFA_FWL_BASEWIDGET_CFX_BARCODE_H_ #define XFA_FWL_BASEWIDGET_CFX_BARCODE_H_ +#include <memory> + #include "core/fxcrt/include/fx_coordinates.h" #include "core/fxcrt/include/fx_string.h" #include "core/fxcrt/include/fx_system.h" @@ -52,7 +54,7 @@ class CFX_Barcode { FX_BOOL SetTruncated(FX_BOOL truncated); protected: - CBC_CodeBase* m_pBCEngine; + std::unique_ptr<CBC_CodeBase> m_pBCEngine; }; #endif // XFA_FWL_BASEWIDGET_CFX_BARCODE_H_ diff --git a/xfa/fwl/basewidget/fwl_caretimp.cpp b/xfa/fwl/basewidget/fwl_caretimp.cpp index dbe8e50bc2..cd51bd7430 100644 --- a/xfa/fwl/basewidget/fwl_caretimp.cpp +++ b/xfa/fwl/basewidget/fwl_caretimp.cpp @@ -38,16 +38,14 @@ FWL_Error IFWL_Caret::SetColor(CFX_Color crFill) { CFWL_CaretImp::CFWL_CaretImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) : CFWL_WidgetImp(properties, pOuter), + m_pTimer(new CFWL_CaretTimer(this)), m_pTimerInfo(nullptr), m_dwElapse(400), m_bSetColor(FALSE) { - m_pTimer = new CFWL_CaretTimer(this); SetStates(FWL_STATE_CAT_HightLight); } -CFWL_CaretImp::~CFWL_CaretImp() { - delete m_pTimer; -} +CFWL_CaretImp::~CFWL_CaretImp() {} FWL_Error CFWL_CaretImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_Caret; diff --git a/xfa/fwl/basewidget/fwl_caretimp.h b/xfa/fwl/basewidget/fwl_caretimp.h index 4f16715cd1..d8b621b43c 100644 --- a/xfa/fwl/basewidget/fwl_caretimp.h +++ b/xfa/fwl/basewidget/fwl_caretimp.h @@ -7,6 +7,8 @@ #ifndef XFA_FWL_BASEWIDGET_FWL_CARETIMP_H_ #define XFA_FWL_BASEWIDGET_FWL_CARETIMP_H_ +#include <memory> + #include "xfa/fwl/core/fwl_widgetimp.h" #include "xfa/fwl/core/ifwl_timer.h" #include "xfa/fwl/core/ifwl_widget.h" @@ -51,8 +53,8 @@ class CFWL_CaretImp : public CFWL_WidgetImp { IFWL_ThemeProvider* pTheme, const CFX_Matrix* pMatrix); - CFWL_CaretTimer* m_pTimer; - IFWL_TimerInfo* m_pTimerInfo; + std::unique_ptr<CFWL_CaretTimer> m_pTimer; + IFWL_TimerInfo* m_pTimerInfo; // not owned. uint32_t m_dwElapse; CFX_Color m_crFill; FX_BOOL m_bSetColor; diff --git a/xfa/fwl/basewidget/fwl_editimp.cpp b/xfa/fwl/basewidget/fwl_editimp.cpp index ae0b7bcc9f..104054f4e1 100644 --- a/xfa/fwl/basewidget/fwl_editimp.cpp +++ b/xfa/fwl/basewidget/fwl_editimp.cpp @@ -203,7 +203,6 @@ CFWL_EditImp::CFWL_EditImp(const CFWL_WidgetImpProperties& properties, m_fVAlignOffset(0.0f), m_fScrollOffsetX(0.0f), m_fScrollOffsetY(0.0f), - m_pEdtEngine(nullptr), m_bLButtonDown(FALSE), m_nSelStart(0), m_nLimit(-1), @@ -223,7 +222,6 @@ CFWL_EditImp::CFWL_EditImp(const CFWL_WidgetImpProperties& properties, } CFWL_EditImp::~CFWL_EditImp() { - delete m_pEdtEngine; ClearRecord(); } @@ -898,26 +896,27 @@ void CFWL_EditImp::On_TextChanged(CFDE_TxtEdtEngine* pEdit, LayoutScrollBar(); Repaint(&rtTemp); } + void CFWL_EditImp::On_SelChanged(CFDE_TxtEdtEngine* pEdit) { CFX_RectF rtTemp; GetClientRect(rtTemp); Repaint(&rtTemp); } + FX_BOOL CFWL_EditImp::On_PageLoad(CFDE_TxtEdtEngine* pEdit, int32_t nPageIndex, int32_t nPurpose) { - CFDE_TxtEdtEngine* pEdtEngine = m_pEdtEngine; - IFDE_TxtEdtPage* pPage = pEdtEngine->GetPage(nPageIndex); + IFDE_TxtEdtPage* pPage = m_pEdtEngine->GetPage(nPageIndex); if (!pPage) return FALSE; pPage->LoadPage(nullptr, nullptr); return TRUE; } + FX_BOOL CFWL_EditImp::On_PageUnload(CFDE_TxtEdtEngine* pEdit, int32_t nPageIndex, int32_t nPurpose) { - CFDE_TxtEdtEngine* pEdtEngine = m_pEdtEngine; - IFDE_TxtEdtPage* pPage = pEdtEngine->GetPage(nPageIndex); + IFDE_TxtEdtPage* pPage = m_pEdtEngine->GetPage(nPageIndex); if (!pPage) return FALSE; pPage->UnloadPage(nullptr); @@ -1630,7 +1629,7 @@ void CFWL_EditImp::InitScrollBar(FX_BOOL bVert) { void CFWL_EditImp::InitEngine() { if (!m_pEdtEngine) - m_pEdtEngine = new CFDE_TxtEdtEngine; + m_pEdtEngine.reset(new CFDE_TxtEdtEngine); } FX_BOOL FWL_ShowCaret(IFWL_Widget* pWidget, diff --git a/xfa/fwl/basewidget/fwl_editimp.h b/xfa/fwl/basewidget/fwl_editimp.h index 3f7a3862dd..e17a4cfc09 100644 --- a/xfa/fwl/basewidget/fwl_editimp.h +++ b/xfa/fwl/basewidget/fwl_editimp.h @@ -152,7 +152,7 @@ class CFWL_EditImp : public CFWL_WidgetImp { FX_FLOAT m_fVAlignOffset; FX_FLOAT m_fScrollOffsetX; FX_FLOAT m_fScrollOffsetY; - CFDE_TxtEdtEngine* m_pEdtEngine; + std::unique_ptr<CFDE_TxtEdtEngine> m_pEdtEngine; FX_BOOL m_bLButtonDown; int32_t m_nSelStart; int32_t m_nLimit; diff --git a/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp b/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp index ca141a2d7a..7477f04bdc 100644 --- a/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp +++ b/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp @@ -151,6 +151,8 @@ CFWL_MonthCalendarImp::CFWL_MonthCalendarImp( const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) : CFWL_WidgetImp(properties, pOuter), + m_bInit(FALSE), + m_pDateTime(new CFX_DateTime), m_iCurYear(2011), m_iCurMonth(1), m_iYear(2011), @@ -158,7 +160,8 @@ CFWL_MonthCalendarImp::CFWL_MonthCalendarImp( m_iDay(1), m_iHovered(-1), m_iLBtnPartStates(CFWL_PartState_Normal), - m_iRBtnPartStates(CFWL_PartState_Normal) { + m_iRBtnPartStates(CFWL_PartState_Normal), + m_iMaxSel(1) { m_rtHead.Reset(); m_rtWeek.Reset(); m_rtLBtn.Reset(); @@ -171,14 +174,10 @@ CFWL_MonthCalendarImp::CFWL_MonthCalendarImp( m_rtClient.Reset(); m_rtWeekNum.Reset(); m_rtWeekNumSep.Reset(); - m_pDateTime = new CFX_DateTime; - m_bInit = FALSE; - m_iMaxSel = 1; } CFWL_MonthCalendarImp::~CFWL_MonthCalendarImp() { ClearDateItem(); - delete m_pDateTime; m_arrSelDays.RemoveAll(); } diff --git a/xfa/fwl/basewidget/fwl_monthcalendarimp.h b/xfa/fwl/basewidget/fwl_monthcalendarimp.h index db6ce7801c..2716f59f95 100644 --- a/xfa/fwl/basewidget/fwl_monthcalendarimp.h +++ b/xfa/fwl/basewidget/fwl_monthcalendarimp.h @@ -7,6 +7,8 @@ #ifndef XFA_FWL_BASEWIDGET_FWL_MONTHCALENDARIMP_H_ #define XFA_FWL_BASEWIDGET_FWL_MONTHCALENDARIMP_H_ +#include <memory> + #include "xfa/fgas/localization/fgas_datetime.h" #include "xfa/fwl/core/fwl_widgetimp.h" #include "xfa/fwl/core/ifwl_widget.h" @@ -164,7 +166,7 @@ class CFWL_MonthCalendarImp : public CFWL_WidgetImp { CFX_RectF m_rtTemp; CFX_WideString m_wsHead; CFX_WideString m_wsToday; - CFX_DateTime* m_pDateTime; + std::unique_ptr<CFX_DateTime> m_pDateTime; CFX_ArrayTemplate<FWL_DATEINFO*> m_arrDates; int32_t m_iCurYear; int32_t m_iCurMonth; diff --git a/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp b/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp index 85af738555..cf89483a9d 100644 --- a/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp +++ b/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp @@ -48,8 +48,7 @@ CFWL_ToolTipImp::CFWL_ToolTipImp(const CFWL_WidgetImpProperties& properties, m_dwTTOStyles(FDE_TTOSTYLE_SingleLine), m_iTTOAlign(FDE_TTOALIGNMENT_Center), m_pTimerInfoShow(nullptr), - m_pTimerInfoHide(nullptr), - m_pTimer(nullptr) { + m_pTimerInfoHide(nullptr) { m_rtClient.Set(0, 0, 0, 0); m_rtCaption.Set(0, 0, 0, 0); m_rtAnchor.Set(0, 0, 0, 0); @@ -57,10 +56,7 @@ CFWL_ToolTipImp::CFWL_ToolTipImp(const CFWL_WidgetImpProperties& properties, m_TimerHide.m_pToolTip = this; } -CFWL_ToolTipImp::~CFWL_ToolTipImp() { - delete m_pTimer; - m_pTimer = nullptr; -} +CFWL_ToolTipImp::~CFWL_ToolTipImp() {} FWL_Error CFWL_ToolTipImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_ToolTip; diff --git a/xfa/fwl/basewidget/fwl_tooltipctrlimp.h b/xfa/fwl/basewidget/fwl_tooltipctrlimp.h index 79e3f49f18..f814eea256 100644 --- a/xfa/fwl/basewidget/fwl_tooltipctrlimp.h +++ b/xfa/fwl/basewidget/fwl_tooltipctrlimp.h @@ -69,7 +69,6 @@ class CFWL_ToolTipImp : public CFWL_FormImp { CFX_RectF m_rtAnchor; IFWL_TimerInfo* m_pTimerInfoShow; IFWL_TimerInfo* m_pTimerInfoHide; - CFWL_ToolTipTimer* m_pTimer; CFWL_ToolTipTimer m_TimerShow; CFWL_ToolTipTimer m_TimerHide; }; |