summaryrefslogtreecommitdiff
path: root/fpdfsdk/pdfwindow
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/pdfwindow')
-rw-r--r--fpdfsdk/pdfwindow/PWL_ComboBox.h10
-rw-r--r--fpdfsdk/pdfwindow/PWL_Edit.h2
-rw-r--r--fpdfsdk/pdfwindow/PWL_Icon.cpp8
-rw-r--r--fpdfsdk/pdfwindow/PWL_Icon.h9
-rw-r--r--fpdfsdk/pdfwindow/PWL_ListBox.cpp6
-rw-r--r--fpdfsdk/pdfwindow/PWL_ListBox.h4
-rw-r--r--fpdfsdk/pdfwindow/PWL_ScrollBar.h7
-rw-r--r--fpdfsdk/pdfwindow/PWL_Wnd.cpp13
-rw-r--r--fpdfsdk/pdfwindow/PWL_Wnd.h7
9 files changed, 34 insertions, 32 deletions
diff --git a/fpdfsdk/pdfwindow/PWL_ComboBox.h b/fpdfsdk/pdfwindow/PWL_ComboBox.h
index 0dfb3bd86b..27cdb61b1a 100644
--- a/fpdfsdk/pdfwindow/PWL_ComboBox.h
+++ b/fpdfsdk/pdfwindow/PWL_ComboBox.h
@@ -52,7 +52,7 @@ class CPWL_ComboBox : public CPWL_Wnd {
CPWL_ComboBox();
~CPWL_ComboBox() override;
- CPWL_Edit* GetEdit() const { return m_pEdit; }
+ CPWL_Edit* GetEdit() const { return m_pEdit.Get(); }
// CPWL_Wnd:
CFX_ByteString GetClassName() const override;
@@ -93,14 +93,14 @@ class CPWL_ComboBox : public CPWL_Wnd {
void CreateListBox(const PWL_CREATEPARAM& cp);
void SetPopup(bool bPopup);
- CPWL_CBEdit* m_pEdit;
- CPWL_CBButton* m_pButton;
- CPWL_CBListBox* m_pList;
+ CFX_UnownedPtr<CPWL_CBEdit> m_pEdit;
+ CFX_UnownedPtr<CPWL_CBButton> m_pButton;
+ CFX_UnownedPtr<CPWL_CBListBox> m_pList;
bool m_bPopup;
CFX_FloatRect m_rcOldWindow;
int32_t m_nPopupWhere;
int32_t m_nSelectItem;
- IPWL_Filler_Notify* m_pFillerNotify;
+ CFX_UnownedPtr<IPWL_Filler_Notify> m_pFillerNotify;
CFX_UnownedPtr<CFFL_FormFiller> m_pFormFiller;
};
diff --git a/fpdfsdk/pdfwindow/PWL_Edit.h b/fpdfsdk/pdfwindow/PWL_Edit.h
index bd3799141a..82c1f19629 100644
--- a/fpdfsdk/pdfwindow/PWL_Edit.h
+++ b/fpdfsdk/pdfwindow/PWL_Edit.h
@@ -134,7 +134,7 @@ class CPWL_Edit : public CPWL_EditCtrl {
CPVT_WordRange GetSameWordsRange(const CPVT_WordPlace& place,
bool bLatin,
bool bArabic) const;
- IPWL_Filler_Notify* m_pFillerNotify;
+ CFX_UnownedPtr<IPWL_Filler_Notify> m_pFillerNotify;
bool m_bFocus;
CFX_FloatRect m_rcOldWindow;
CFX_UnownedPtr<CFFL_FormFiller> m_pFormFiller;
diff --git a/fpdfsdk/pdfwindow/PWL_Icon.cpp b/fpdfsdk/pdfwindow/PWL_Icon.cpp
index 3ae7244552..e1397bff0c 100644
--- a/fpdfsdk/pdfwindow/PWL_Icon.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Icon.cpp
@@ -55,8 +55,8 @@ void CPWL_Image::SetPDFStream(CPDF_Stream* pStream) {
m_pPDFStream = pStream;
}
-CPDF_Stream* CPWL_Image::GetPDFStream() {
- return m_pPDFStream;
+CPDF_Stream* CPWL_Image::GetPDFStream() const {
+ return m_pPDFStream.Get();
}
void CPWL_Image::GetImageSize(float& fWidth, float& fHeight) {
@@ -114,8 +114,8 @@ CPWL_Icon::CPWL_Icon() : m_pIconFit(nullptr) {}
CPWL_Icon::~CPWL_Icon() {}
-CPDF_IconFit* CPWL_Icon::GetIconFit() {
- return m_pIconFit;
+CPDF_IconFit* CPWL_Icon::GetIconFit() const {
+ return m_pIconFit.Get();
}
int32_t CPWL_Icon::GetScaleMethod() {
diff --git a/fpdfsdk/pdfwindow/PWL_Icon.h b/fpdfsdk/pdfwindow/PWL_Icon.h
index 49ac1f3f3d..c5d116be69 100644
--- a/fpdfsdk/pdfwindow/PWL_Icon.h
+++ b/fpdfsdk/pdfwindow/PWL_Icon.h
@@ -7,6 +7,7 @@
#ifndef FPDFSDK_PDFWINDOW_PWL_ICON_H_
#define FPDFSDK_PDFWINDOW_PWL_ICON_H_
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_string.h"
#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
@@ -19,7 +20,7 @@ class CPWL_Image : public CPWL_Wnd {
virtual void GetScale(float& fHScale, float& fVScale);
virtual void GetImageOffset(float& x, float& y);
- virtual CPDF_Stream* GetPDFStream();
+ virtual CPDF_Stream* GetPDFStream() const;
public:
void SetPDFStream(CPDF_Stream* pStream);
@@ -29,7 +30,7 @@ class CPWL_Image : public CPWL_Wnd {
void SetImageAlias(const char* sImageAlias);
protected:
- CPDF_Stream* m_pPDFStream;
+ CFX_UnownedPtr<CPDF_Stream> m_pPDFStream;
CFX_ByteString m_sImageAlias;
};
@@ -38,7 +39,7 @@ class CPWL_Icon : public CPWL_Image {
CPWL_Icon();
~CPWL_Icon() override;
- virtual CPDF_IconFit* GetIconFit();
+ virtual CPDF_IconFit* GetIconFit() const;
// CPWL_Image
void GetScale(float& fHScale, float& fVScale) override;
@@ -51,7 +52,7 @@ class CPWL_Icon : public CPWL_Image {
void SetIconFit(CPDF_IconFit* pIconFit) { m_pIconFit = pIconFit; }
private:
- CPDF_IconFit* m_pIconFit;
+ CFX_UnownedPtr<CPDF_IconFit> m_pIconFit;
};
#endif // FPDFSDK_PDFWINDOW_PWL_ICON_H_
diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.cpp b/fpdfsdk/pdfwindow/PWL_ListBox.cpp
index b682959426..09487c3314 100644
--- a/fpdfsdk/pdfwindow/PWL_ListBox.cpp
+++ b/fpdfsdk/pdfwindow/PWL_ListBox.cpp
@@ -36,7 +36,8 @@ void CPWL_List_Notify::IOnSetScrollInfoY(float fPlateMin,
Info.fSmallStep = fSmallStep;
Info.fBigStep = fBigStep;
- m_pList->OnNotify(m_pList, PNM_SETSCROLLINFO, SBT_VSCROLL, (intptr_t)&Info);
+ m_pList->OnNotify(m_pList.Get(), PNM_SETSCROLLINFO, SBT_VSCROLL,
+ reinterpret_cast<intptr_t>(&Info));
if (CPWL_ScrollBar* pScroll = m_pList->GetVScrollBar()) {
if (IsFloatBigger(Info.fPlateWidth, Info.fContentMax - Info.fContentMin) ||
@@ -55,7 +56,8 @@ void CPWL_List_Notify::IOnSetScrollInfoY(float fPlateMin,
}
void CPWL_List_Notify::IOnSetScrollPosY(float fy) {
- m_pList->OnNotify(m_pList, PNM_SETSCROLLPOS, SBT_VSCROLL, (intptr_t)&fy);
+ m_pList->OnNotify(m_pList.Get(), PNM_SETSCROLLPOS, SBT_VSCROLL,
+ reinterpret_cast<intptr_t>(&fy));
}
void CPWL_List_Notify::IOnInvalidateRect(CFX_FloatRect* pRect) {
diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.h b/fpdfsdk/pdfwindow/PWL_ListBox.h
index 0de9c91195..75d23bb7c6 100644
--- a/fpdfsdk/pdfwindow/PWL_ListBox.h
+++ b/fpdfsdk/pdfwindow/PWL_ListBox.h
@@ -41,7 +41,7 @@ class CPWL_List_Notify {
const CPVT_WordPlace& place);
private:
- CPWL_ListBox* m_pList;
+ CFX_UnownedPtr<CPWL_ListBox> m_pList;
};
class CPWL_ListBox : public CPWL_Wnd {
@@ -109,7 +109,7 @@ class CPWL_ListBox : public CPWL_Wnd {
std::unique_ptr<CPWL_List_Notify> m_pListNotify;
bool m_bMouseDown;
bool m_bHoverSel;
- IPWL_Filler_Notify* m_pFillerNotify;
+ CFX_UnownedPtr<IPWL_Filler_Notify> m_pFillerNotify;
private:
CFX_UnownedPtr<CFFL_FormFiller> m_pFormFiller;
diff --git a/fpdfsdk/pdfwindow/PWL_ScrollBar.h b/fpdfsdk/pdfwindow/PWL_ScrollBar.h
index 50b0801ca3..41df6550e0 100644
--- a/fpdfsdk/pdfwindow/PWL_ScrollBar.h
+++ b/fpdfsdk/pdfwindow/PWL_ScrollBar.h
@@ -7,6 +7,7 @@
#ifndef FPDFSDK_PDFWINDOW_PWL_SCROLLBAR_H_
#define FPDFSDK_PDFWINDOW_PWL_SCROLLBAR_H_
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
class CPWL_SBButton;
@@ -169,9 +170,9 @@ class CPWL_ScrollBar : public CPWL_Wnd {
PWL_SCROLLBAR_TYPE m_sbType;
PWL_SCROLL_INFO m_OriginInfo;
- CPWL_SBButton* m_pMinButton;
- CPWL_SBButton* m_pMaxButton;
- CPWL_SBButton* m_pPosButton;
+ CFX_UnownedPtr<CPWL_SBButton> m_pMinButton;
+ CFX_UnownedPtr<CPWL_SBButton> m_pMaxButton;
+ CFX_UnownedPtr<CPWL_SBButton> m_pPosButton;
PWL_SCROLL_PRIVATEDATA m_sData;
bool m_bMouseDown;
bool m_bMinOrMax;
diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/pdfwindow/PWL_Wnd.cpp
index 5523c59317..1db79b4bc7 100644
--- a/fpdfsdk/pdfwindow/PWL_Wnd.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Wnd.cpp
@@ -180,9 +180,9 @@ class CPWL_MsgControl {
private:
std::vector<CPWL_Wnd*> m_aMousePath;
std::vector<CPWL_Wnd*> m_aKeyboardPath;
- CPWL_Wnd* m_pCreatedWnd;
- CPWL_Wnd* m_pMainMouseWnd;
- CPWL_Wnd* m_pMainKeyboardWnd;
+ CFX_UnownedPtr<CPWL_Wnd> m_pCreatedWnd;
+ CFX_UnownedPtr<CPWL_Wnd> m_pMainMouseWnd;
+ CFX_UnownedPtr<CPWL_Wnd> m_pMainKeyboardWnd;
};
CPWL_Wnd::CPWL_Wnd()
@@ -594,10 +594,7 @@ void* CPWL_Wnd::GetAttachedData() const {
}
CPWL_ScrollBar* CPWL_Wnd::GetVScrollBar() const {
- if (HasFlag(PWS_VSCROLL))
- return m_pVScrollBar;
-
- return nullptr;
+ return HasFlag(PWS_VSCROLL) ? m_pVScrollBar.Get() : nullptr;
}
void CPWL_Wnd::CreateScrollBar(const PWL_CREATEPARAM& cp) {
@@ -885,7 +882,7 @@ void CPWL_Wnd::SetChildMatrix(const CFX_Matrix& mt) {
const CPWL_Wnd* CPWL_Wnd::GetFocused() const {
CPWL_MsgControl* pMsgCtrl = GetMsgControl();
- return pMsgCtrl ? pMsgCtrl->m_pMainKeyboardWnd : nullptr;
+ return pMsgCtrl ? pMsgCtrl->m_pMainKeyboardWnd.Get() : nullptr;
}
void CPWL_Wnd::EnableWindow(bool bEnable) {
diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.h b/fpdfsdk/pdfwindow/PWL_Wnd.h
index ded003c31b..59de290653 100644
--- a/fpdfsdk/pdfwindow/PWL_Wnd.h
+++ b/fpdfsdk/pdfwindow/PWL_Wnd.h
@@ -12,6 +12,7 @@
#include "core/fpdfdoc/cpdf_formcontrol.h"
#include "core/fxcrt/cfx_observable.h"
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_basic.h"
#include "fpdfsdk/cfx_systemhandler.h"
#include "fpdfsdk/cpdfsdk_widget.h"
@@ -224,8 +225,8 @@ class CPWL_Timer {
private:
int32_t m_nTimerID;
- CPWL_TimerHandler* m_pAttached;
- CFX_SystemHandler* m_pSystemHandler;
+ CFX_UnownedPtr<CPWL_TimerHandler> m_pAttached;
+ CFX_UnownedPtr<CFX_SystemHandler> m_pSystemHandler;
};
class CPWL_TimerHandler {
@@ -398,7 +399,7 @@ class CPWL_Wnd : public CPWL_TimerHandler {
std::vector<CPWL_Wnd*> m_Children;
PWL_CREATEPARAM m_sPrivateParam;
- CPWL_ScrollBar* m_pVScrollBar;
+ CFX_UnownedPtr<CPWL_ScrollBar> m_pVScrollBar;
CFX_FloatRect m_rcWindow;
CFX_FloatRect m_rcClip;
bool m_bCreated;