summaryrefslogtreecommitdiff
path: root/fpdfsdk/pdfwindow
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-04-06 14:18:42 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-06 14:18:42 -0700
commit0b5adb6ead171069aa6f8c49c529f1c6d381e155 (patch)
tree92090dfbfb39c8bef05a9085d1eb273cd8913f0f /fpdfsdk/pdfwindow
parent7a4374583efc0c41c826122aa26c1198c8d5cc37 (diff)
downloadpdfium-0b5adb6ead171069aa6f8c49c529f1c6d381e155.tar.xz
Remove IPWL_NoteNotify and CPWL_Note.
The IPWL_NoteNotify interface was never implemented. In removing, found that CPWL_Note was never created. Removed both classes. There were a bunch of methods that were never called that interacted with this code that have also been removed. BUG=pdfium:468 Review URL: https://codereview.chromium.org/1867623002
Diffstat (limited to 'fpdfsdk/pdfwindow')
-rw-r--r--fpdfsdk/pdfwindow/PWL_Note.cpp656
-rw-r--r--fpdfsdk/pdfwindow/PWL_Note.h93
2 files changed, 1 insertions, 748 deletions
diff --git a/fpdfsdk/pdfwindow/PWL_Note.cpp b/fpdfsdk/pdfwindow/PWL_Note.cpp
index e0f9132b18..964948ee53 100644
--- a/fpdfsdk/pdfwindow/PWL_Note.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Note.cpp
@@ -137,17 +137,6 @@ void CPWL_Note_Edit::OnSetFocus() {
void CPWL_Note_Edit::OnKillFocus() {
EnableSpellCheck(FALSE);
-
- if (CPWL_Wnd* pParent = GetParentWindow()) {
- if (CPWL_Wnd* pGrand = pParent->GetParentWindow()) {
- ASSERT(pGrand->GetClassName() == "CPWL_NoteItem");
-
- CPWL_NoteItem* pNoteItem = (CPWL_NoteItem*)pGrand;
-
- pNoteItem->OnContentsValidate();
- }
- }
-
CPWL_Edit::OnKillFocus();
}
@@ -388,29 +377,6 @@ CFX_WideString CPWL_Note_Contents::GetText() const {
return L"";
}
-CPWL_NoteItem* CPWL_Note_Contents::CreateSubItem() {
- CPWL_NoteItem* pNoteItem = new CPWL_NoteItem;
- PWL_CREATEPARAM icp = GetCreationParam();
- icp.pParentWnd = this;
- icp.dwFlags = PWS_CHILD | PWS_VISIBLE | PWS_BACKGROUND;
- pNoteItem->Create(icp);
-
- pNoteItem->OnCreateNoteItem();
-
- pNoteItem->ResetSubjectName(m_aChildren.GetSize() - 1);
-
- FX_SYSTEMTIME st;
- if (IFX_SystemHandler* pSH = GetSystemHandler())
- st = pSH->GetLocalTime();
- pNoteItem->SetDateTime(st);
-
- pNoteItem->SetContents(L"");
-
- OnNotify(pNoteItem, PNM_NOTEEDITCHANGED, 0, 0);
-
- return pNoteItem;
-}
-
int32_t CPWL_Note_Contents::CountSubItems() const {
return m_aChildren.GetSize() - 1;
}
@@ -428,28 +394,6 @@ IPWL_NoteItem* CPWL_Note_Contents::GetSubItems(int32_t index) const {
return NULL;
}
-void CPWL_Note_Contents::DeleteSubItem(IPWL_NoteItem* pNoteItem) {
- int32_t nIndex = GetItemIndex((CPWL_NoteItem*)pNoteItem);
-
- if (nIndex > 0) {
- if (CPWL_NoteItem* pPWLNoteItem = (CPWL_NoteItem*)pNoteItem) {
- pPWLNoteItem->KillFocus();
- pPWLNoteItem->Destroy();
- delete pPWLNoteItem;
- }
-
- for (int32_t i = nIndex, sz = m_aChildren.GetSize(); i < sz; i++) {
- if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) {
- ASSERT(pChild->GetClassName() == "CPWL_NoteItem");
- CPWL_NoteItem* pItem = (CPWL_NoteItem*)pChild;
- pItem->ResetSubjectName(i);
- }
- }
-
- OnNotify(this, PNM_NOTEEDITCHANGED, 0, 0);
- }
-}
-
IPWL_NoteItem* CPWL_Note_Contents::GetHitNoteItem(const CFX_FloatPoint& point) {
CFX_FloatPoint pt = ParentToChild(point);
@@ -691,51 +635,11 @@ void CPWL_NoteItem::SetBkColor(const CPWL_Color& color) {
m_pDateTime->SetTextColor(sTextColor);
InvalidateRect(nullptr);
-
- if (IPWL_NoteNotify* pNotify = GetNoteNotify()) {
- pNotify->OnSetBkColor(this);
- }
}
void CPWL_NoteItem::SetSubjectName(const CFX_WideString& sName) {
- if (m_pSubject) {
+ if (m_pSubject)
m_pSubject->SetText(sName.c_str());
- }
-
- if (IPWL_NoteNotify* pNotify = GetNoteNotify()) {
- pNotify->OnSetSubjectName(this);
- }
-}
-
-void CPWL_NoteItem::SetAuthorName(const CFX_WideString& sName) {
- m_sAuthor = sName;
- ResetSubjectName(-1);
-
- if (IPWL_NoteNotify* pNotify = GetNoteNotify()) {
- pNotify->OnSetAuthorName(this);
- }
-}
-
-void CPWL_NoteItem::ResetSubjectName(int32_t nItemIndex) {
- if (nItemIndex < 0) {
- if (CPWL_Wnd* pParent = GetParentWindow()) {
- ASSERT(pParent->GetClassName() == "CPWL_Note_Contents");
-
- CPWL_Note_Contents* pContents = (CPWL_Note_Contents*)pParent;
- nItemIndex = pContents->GetItemIndex(this);
- }
- }
-
- const CPWL_Note* pNote = GetNote();
- CFX_WideString sSubject;
- sSubject.Format(pNote->GetReplyString().c_str(), nItemIndex);
-
- if (!m_sAuthor.IsEmpty()) {
- sSubject += L" - ";
- sSubject += m_sAuthor;
- }
- SetSubjectName(sSubject);
- RePosChildWnd();
}
void CPWL_NoteItem::SetDateTime(FX_SYSTEMTIME time) {
@@ -749,20 +653,12 @@ void CPWL_NoteItem::SetDateTime(FX_SYSTEMTIME time) {
}
RePosChildWnd();
-
- if (IPWL_NoteNotify* pNotify = GetNoteNotify()) {
- pNotify->OnSetDateTime(this);
- }
}
void CPWL_NoteItem::SetContents(const CFX_WideString& sContents) {
if (m_pContents) {
m_pContents->SetText(sContents);
}
-
- if (IPWL_NoteNotify* pNotify = GetNoteNotify()) {
- pNotify->OnSetContents(this);
- }
}
CPWL_NoteItem* CPWL_NoteItem::GetParentNoteItem() const {
@@ -816,17 +712,6 @@ CFX_WideString CPWL_NoteItem::GetSubjectName() const {
return L"";
}
-CPWL_NoteItem* CPWL_NoteItem::CreateNoteItem() {
- if (m_pContents)
- return m_pContents->CreateSubItem();
-
- return NULL;
-}
-
-IPWL_NoteItem* CPWL_NoteItem::CreateSubItem() {
- return CreateNoteItem();
-}
-
int32_t CPWL_NoteItem::CountSubItems() const {
if (m_pContents)
return m_pContents->CountSubItems();
@@ -841,17 +726,6 @@ IPWL_NoteItem* CPWL_NoteItem::GetSubItems(int32_t index) const {
return NULL;
}
-void CPWL_NoteItem::DeleteSubItem(IPWL_NoteItem* pNoteItem) {
- KillFocus();
-
- if (IPWL_NoteNotify* pNotify = GetNoteNotify()) {
- pNotify->OnItemDelete(pNoteItem);
- }
-
- if (m_pContents)
- m_pContents->DeleteSubItem(pNoteItem);
-}
-
IPWL_NoteItem* CPWL_NoteItem::GetHitNoteItem(const CFX_FloatPoint& point) {
CFX_FloatPoint pt = ParentToChild(point);
@@ -969,44 +843,6 @@ void CPWL_NoteItem::OnNotify(CPWL_Wnd* pWnd,
}
void CPWL_NoteItem::PopupNoteItemMenu(const CFX_FloatPoint& point) {
- if (IPWL_NoteNotify* pNotify = GetNoteNotify()) {
- int32_t x, y;
- PWLtoWnd(point, x, y);
- if (IFX_SystemHandler* pSH = GetSystemHandler())
- pSH->ClientToScreen(GetAttachedHWnd(), x, y);
- pNotify->OnPopupMenu(this, x, y);
- }
-}
-
-const CPWL_Note* CPWL_NoteItem::GetNote() const {
- if (const CPWL_Wnd* pRoot = GetRootWnd()) {
- ASSERT(pRoot->GetClassName() == "CPWL_NoteItem");
- CPWL_NoteItem* pNoteItem = (CPWL_NoteItem*)pRoot;
- if (pNoteItem->IsTopItem()) {
- return (CPWL_Note*)pNoteItem;
- }
- }
-
- return NULL;
-}
-
-IPWL_NoteNotify* CPWL_NoteItem::GetNoteNotify() const {
- if (const CPWL_Note* pNote = GetNote())
- return pNote->GetNoteNotify();
-
- return NULL;
-}
-
-void CPWL_NoteItem::OnCreateNoteItem() {
- if (IPWL_NoteNotify* pNotify = GetNoteNotify()) {
- pNotify->OnItemCreate(this);
- }
-}
-
-void CPWL_NoteItem::OnContentsValidate() {
- if (IPWL_NoteNotify* pNotify = GetNoteNotify()) {
- pNotify->OnSetContents(this);
- }
}
void CPWL_NoteItem::SetNoteFocus(FX_BOOL bLast) {
@@ -1021,493 +857,3 @@ void CPWL_NoteItem::EnableModify(FX_BOOL bEnabled) {
void CPWL_NoteItem::EnableRead(FX_BOOL bEnabled) {
m_pContents->EnableRead(bEnabled);
}
-
-CPWL_Note::CPWL_Note(IPopup_Note* pPopupNote,
- IPWL_NoteNotify* pNoteNotify,
- IPWL_NoteHandler* pNoteHandler)
- : m_pAuthor(NULL),
- m_pIcon(NULL),
- m_pCloseBox(NULL),
- m_pLBBox(NULL),
- m_pRBBox(NULL),
- m_pContentsBar(NULL),
- m_pOptions(NULL),
- m_pNoteNotify(pNoteNotify),
- m_bResizing(FALSE),
- m_bEnableNotify(TRUE) {}
-
-CPWL_Note::~CPWL_Note() {}
-
-IPWL_NoteItem* CPWL_Note::Reply() {
- return CreateNoteItem();
-}
-
-void CPWL_Note::EnableNotify(FX_BOOL bEnabled) {
- m_bEnableNotify = bEnabled;
-}
-
-void CPWL_Note::RePosChildWnd() {
- RePosNoteChildren();
- m_pContents->OnNotify(this, PNM_NOTERESET, 0, 0);
- ResetScrollBar();
- m_pContents->OnNotify(this, PNM_NOTERESET, 0, 0);
- OnNotify(this, PNM_NOTEEDITCHANGED, 0, 0);
- if (const CPWL_Wnd* pWnd = GetFocused()) {
- if (pWnd->GetClassName() == "CPWL_Edit") {
- CPWL_Edit* pEdit = (CPWL_Edit*)pWnd;
- pEdit->SetCaret(pEdit->GetCaret());
- }
- }
-}
-
-FX_BOOL CPWL_Note::ResetScrollBar() {
- FX_BOOL bScrollChanged = FALSE;
-
- if (ScrollBarShouldVisible()) {
- if (!m_pContentsBar->IsVisible()) {
- m_pContentsBar->SetVisible(TRUE);
- if (m_pContentsBar->IsVisible()) {
- m_pContentsBar->InvalidateRect(NULL);
- bScrollChanged = TRUE;
- }
- }
- } else {
- if (m_pContentsBar->IsVisible()) {
- m_pContentsBar->SetVisible(FALSE);
- m_pContentsBar->InvalidateRect(NULL);
-
- bScrollChanged = TRUE;
- }
- }
-
- if (bScrollChanged) {
- CFX_FloatRect rcNote = GetClientRect();
- CFX_FloatRect rcContents = m_pContents->GetWindowRect();
- rcContents.right = rcNote.right - 3.0f;
- if (m_pContentsBar->IsVisible())
- rcContents.right -= PWL_SCROLLBAR_WIDTH;
- m_pContents->Move(rcContents, TRUE, TRUE);
- m_pContents->SetScrollPos(CFX_FloatPoint(0.0f, 0.0f));
- m_pContents->InvalidateRect(NULL);
- }
-
- return bScrollChanged;
-}
-
-FX_BOOL CPWL_Note::ScrollBarShouldVisible() {
- CFX_FloatRect rcContentsFact = m_pContents->GetScrollArea();
- CFX_FloatRect rcContentsClient = m_pContents->GetClientRect();
-
- return rcContentsFact.Height() > rcContentsClient.Height();
-}
-
-void CPWL_Note::SetOptionsText(const CFX_WideString& sText) {
- if (m_pOptions)
- m_pOptions->SetText(sText);
-
- RePosNoteChildren();
-}
-
-void CPWL_Note::RePosNoteChildren() {
- if (m_bResizing)
- return;
-
- m_bResizing = TRUE;
-
- if (IsValid()) {
- CFX_FloatRect rcClient = GetClientRect();
-
- CFX_FloatRect rcIcon = rcClient;
- rcIcon.top -= 2.0f;
- rcIcon.right = rcIcon.left + 14.0f;
- rcIcon.bottom = rcIcon.top - 14.0f;
- rcIcon.Normalize();
- m_pIcon->Move(rcIcon, TRUE, FALSE);
- m_pIcon->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcIcon));
-
- CFX_FloatRect rcCloseBox = rcClient;
- rcCloseBox.right -= 1.0f;
- rcCloseBox.top -= 1.0f;
- rcCloseBox.left = rcCloseBox.right - 14.0f;
- rcCloseBox.bottom = rcCloseBox.top - 14.0f;
- rcCloseBox.Normalize();
- m_pCloseBox->Move(rcCloseBox, TRUE, FALSE);
- m_pCloseBox->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcCloseBox));
-
- CFX_FloatRect rcDate = rcClient;
- rcDate.right = rcCloseBox.left - POPUP_ITEM_TEXT_INDENT;
- rcDate.left =
- PWL_MAX(rcDate.right - m_pDateTime->GetContentRect().Width() - 1.0f,
- rcIcon.right + 1.0f);
- rcDate.top = rcClient.top - 2.0f;
- rcDate.bottom = rcDate.top - m_pDateTime->GetContentRect().Height();
- rcDate.Normalize();
- m_pDateTime->Move(rcDate, TRUE, FALSE);
- m_pDateTime->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcDate));
-
- CFX_FloatRect rcSubject = rcClient;
- rcSubject.top = rcClient.top - 2.0f;
- rcSubject.left = rcIcon.right + POPUP_ITEM_TEXT_INDENT;
- rcSubject.right =
- PWL_MIN(rcSubject.left + m_pSubject->GetContentRect().Width() + 1.0f,
- rcDate.left - 1.0f);
- rcSubject.bottom = rcSubject.top - m_pSubject->GetContentRect().Height();
- rcSubject.Normalize();
- m_pSubject->Move(rcSubject, TRUE, FALSE);
- m_pSubject->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcSubject));
-
- CFX_FloatRect rcOptions = rcClient;
- rcOptions.left =
- PWL_MAX(rcOptions.right - m_pOptions->GetContentRect().Width(),
- rcIcon.right + 1.0f);
- rcOptions.top = rcSubject.bottom - 4.0f;
- rcOptions.bottom = rcOptions.top - m_pOptions->GetContentRect().Height();
- rcOptions.Normalize();
- m_pOptions->Move(rcOptions, TRUE, FALSE);
- m_pOptions->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcOptions));
-
- CFX_FloatRect rcAuthor = rcClient;
- rcAuthor.top = rcSubject.bottom - 4.0f;
- rcAuthor.left = rcSubject.left;
- rcAuthor.right =
- PWL_MIN(rcSubject.left + m_pAuthor->GetContentRect().Width() + 1.0f,
- rcOptions.left - 1.0f);
- rcAuthor.bottom = rcAuthor.top - m_pAuthor->GetContentRect().Height();
- rcAuthor.Normalize();
- m_pAuthor->Move(rcAuthor, TRUE, FALSE);
- m_pAuthor->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcAuthor));
-
- CFX_FloatRect rcLBBox = rcClient;
- rcLBBox.top = rcLBBox.bottom + 7.0f;
- rcLBBox.right = rcLBBox.left + 7.0f;
- rcLBBox.Normalize();
- m_pLBBox->Move(rcLBBox, TRUE, FALSE);
- m_pLBBox->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcLBBox));
-
- CFX_FloatRect rcRBBox = rcClient;
- rcRBBox.top = rcRBBox.bottom + 7.0f;
- rcRBBox.left = rcRBBox.right - 7.0f;
- rcRBBox.Normalize();
- m_pRBBox->Move(rcRBBox, TRUE, FALSE);
- m_pRBBox->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcRBBox));
-
- CFX_FloatRect rcContents = rcClient;
- rcContents.top = rcAuthor.bottom - POPUP_ITEM_HEAD_BOTTOM;
- rcContents.left += 3.0f;
- rcContents.right -= 3.0f;
- if (m_pContentsBar->IsVisible())
- rcContents.right -= PWL_SCROLLBAR_WIDTH;
- rcContents.bottom += 14.0f;
- rcContents.Normalize();
- m_pContents->Move(rcContents, FALSE, FALSE);
- m_pContents->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcContents));
-
- CFX_FloatRect rcContentsBar = rcContents;
- rcContentsBar.right = rcClient.right - 3.0f;
- rcContentsBar.left = rcContentsBar.right - PWL_SCROLLBAR_WIDTH;
- rcContentsBar.Normalize();
- m_pContentsBar->Move(rcContentsBar, TRUE, FALSE);
- }
-
- m_bResizing = FALSE;
-}
-
-void CPWL_Note::CreateChildWnd(const PWL_CREATEPARAM& cp) {
- CPWL_NoteItem::CreateChildWnd(cp);
-
- CPWL_Color sTextColor;
-
- if (CPWL_Utils::IsBlackOrWhite(GetBackgroundColor()))
- sTextColor = PWL_DEFAULT_WHITECOLOR;
- else
- sTextColor = PWL_DEFAULT_BLACKCOLOR;
-
- m_pAuthor = new CPWL_Label;
- PWL_CREATEPARAM acp = cp;
- acp.pParentWnd = this;
- acp.dwFlags = PWS_VISIBLE | PWS_CHILD | PES_LEFT | PES_TOP;
- acp.sTextColor = sTextColor;
- m_pAuthor->Create(acp);
-
- m_pCloseBox = new CPWL_Note_CloseBox;
- PWL_CREATEPARAM ccp = cp;
- ccp.pParentWnd = this;
- ccp.dwBorderWidth = 2;
- ccp.nBorderStyle = PBS_BEVELED;
- ccp.dwFlags = PWS_VISIBLE | PWS_CHILD | PWS_BORDER;
- ccp.sTextColor = sTextColor;
- m_pCloseBox->Create(ccp);
-
- m_pIcon = new CPWL_Note_Icon;
- PWL_CREATEPARAM icp = cp;
- icp.pParentWnd = this;
- icp.dwFlags = PWS_VISIBLE | PWS_CHILD;
- m_pIcon->Create(icp);
-
- m_pOptions = new CPWL_Note_Options;
- PWL_CREATEPARAM ocp = cp;
- ocp.pParentWnd = this;
- ocp.dwFlags = PWS_CHILD | PWS_VISIBLE;
- ocp.sTextColor = sTextColor;
- m_pOptions->Create(ocp);
-
- m_pLBBox = new CPWL_Note_LBBox;
- PWL_CREATEPARAM lcp = cp;
- lcp.pParentWnd = this;
- lcp.dwFlags = PWS_VISIBLE | PWS_CHILD;
- lcp.eCursorType = FXCT_NESW;
- lcp.sTextColor = sTextColor;
- m_pLBBox->Create(lcp);
-
- m_pRBBox = new CPWL_Note_RBBox;
- PWL_CREATEPARAM rcp = cp;
- rcp.pParentWnd = this;
- rcp.dwFlags = PWS_VISIBLE | PWS_CHILD;
- rcp.eCursorType = FXCT_NWSE;
- rcp.sTextColor = sTextColor;
- m_pRBBox->Create(rcp);
-
- m_pContentsBar = new CPWL_ScrollBar(SBT_VSCROLL);
- PWL_CREATEPARAM scp = cp;
- scp.pParentWnd = this;
- scp.sBackgroundColor =
- CPWL_Color(COLORTYPE_RGB, 240 / 255.0f, 240 / 255.0f, 240 / 255.0f);
- scp.dwFlags = PWS_CHILD | PWS_VISIBLE | PWS_BACKGROUND;
- m_pContentsBar->Create(scp);
- m_pContentsBar->SetNotifyForever(TRUE);
-}
-
-void CPWL_Note::SetSubjectName(const CFX_WideString& sName) {
- CPWL_NoteItem::SetSubjectName(sName);
- RePosChildWnd();
-}
-
-void CPWL_Note::SetAuthorName(const CFX_WideString& sName) {
- if (m_pAuthor) {
- m_pAuthor->SetText(sName.c_str());
- RePosChildWnd();
- }
-
- if (IPWL_NoteNotify* pNotify = GetNoteNotify()) {
- pNotify->OnSetAuthorName(this);
- }
-}
-
-CFX_WideString CPWL_Note::GetAuthorName() const {
- if (m_pAuthor)
- return m_pAuthor->GetText();
-
- return L"";
-}
-
-FX_BOOL CPWL_Note::OnMouseWheel(short zDelta,
- const CFX_FloatPoint& point,
- uint32_t nFlag) {
- CFX_FloatPoint ptScroll = m_pContents->GetScrollPos();
- CFX_FloatRect rcScroll = m_pContents->GetScrollArea();
- CFX_FloatRect rcContents = m_pContents->GetClientRect();
-
- if (rcScroll.top - rcScroll.bottom > rcContents.Height()) {
- CFX_FloatPoint ptNew = ptScroll;
-
- if (zDelta > 0)
- ptNew.y += 30;
- else
- ptNew.y -= 30;
-
- if (ptNew.y > rcScroll.top)
- ptNew.y = rcScroll.top;
- if (ptNew.y < rcScroll.bottom + rcContents.Height())
- ptNew.y = rcScroll.bottom + rcContents.Height();
- if (ptNew.y < rcScroll.bottom)
- ptNew.y = rcScroll.bottom;
-
- if (ptNew.y != ptScroll.y) {
- m_pContents->OnNotify(this, PNM_NOTERESET, 0, 0);
- m_pContents->OnNotify(this, PNM_SCROLLWINDOW, SBT_VSCROLL,
- (intptr_t)&ptNew.y);
- m_pContentsBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL,
- (intptr_t)&ptNew.y);
-
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-void CPWL_Note::OnNotify(CPWL_Wnd* pWnd,
- uint32_t msg,
- intptr_t wParam,
- intptr_t lParam) {
- switch (msg) {
- case PNM_NOTEEDITCHANGED: {
- CFX_FloatRect rcScroll = m_pContents->GetScrollArea();
-
- PWL_SCROLL_INFO sInfo;
- sInfo.fContentMin = rcScroll.bottom;
- sInfo.fContentMax = rcScroll.top;
- sInfo.fPlateWidth = m_pContents->GetClientRect().Height();
- sInfo.fSmallStep = 13.0f;
- sInfo.fBigStep = sInfo.fPlateWidth;
-
- if (FXSYS_memcmp(&m_OldScrollInfo, &sInfo, sizeof(PWL_SCROLL_INFO)) !=
- 0) {
- FX_BOOL bScrollChanged = FALSE;
-
- if (lParam < 3) {
- bScrollChanged = ResetScrollBar();
- if (bScrollChanged) {
- lParam++;
- m_pContents->OnNotify(this, PNM_NOTERESET, 0, 0);
- OnNotify(this, PNM_NOTEEDITCHANGED, 0, lParam);
- }
- }
-
- if (!bScrollChanged) {
- if (m_pContentsBar->IsVisible()) {
- m_pContentsBar->OnNotify(pWnd, PNM_SETSCROLLINFO, SBT_VSCROLL,
- (intptr_t)&sInfo);
- m_OldScrollInfo = sInfo;
-
- CFX_FloatPoint ptScroll = m_pContents->GetScrollPos();
- CFX_FloatPoint ptOld = ptScroll;
-
- if (ptScroll.y > sInfo.fContentMax)
- ptScroll.y = sInfo.fContentMax;
- if (ptScroll.y < sInfo.fContentMin + sInfo.fPlateWidth)
- ptScroll.y = sInfo.fContentMin + sInfo.fPlateWidth;
- if (ptScroll.y < sInfo.fContentMin)
- ptScroll.y = sInfo.fContentMin;
-
- if (ptOld.y != ptScroll.y) {
- m_pContentsBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL,
- (intptr_t)&ptScroll.y);
- m_pContentsBar->InvalidateRect(NULL);
- m_pContents->OnNotify(this, PNM_SCROLLWINDOW, SBT_VSCROLL,
- (intptr_t)&ptScroll.y);
- }
- }
- }
- }
- }
-
- m_pContents->InvalidateRect(NULL);
-
- return;
- case PNM_SCROLLWINDOW:
- if (m_pContents)
- m_pContents->OnNotify(pWnd, msg, wParam, lParam);
- return;
- case PNM_SETSCROLLPOS:
- if (m_pContentsBar)
- m_pContentsBar->OnNotify(pWnd, PNM_SETSCROLLPOS, wParam, lParam);
- return;
- }
-
- if (msg == PNM_SETCARETINFO && IsValid()) {
- if (PWL_CARET_INFO* pInfo = (PWL_CARET_INFO*)wParam) {
- if (m_pContents) {
- CFX_FloatRect rcClient = m_pContents->GetClientRect();
- if (pInfo->ptHead.y > rcClient.top) {
- CFX_FloatPoint pt = m_pContents->OutToIn(pInfo->ptHead);
- m_pContents->OnNotify(this, PNM_SCROLLWINDOW, SBT_VSCROLL,
- (intptr_t)&pt.y);
-
- CFX_FloatPoint ptScroll = m_pContents->GetScrollPos();
- m_pContentsBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL,
- (intptr_t)&ptScroll.y);
-
- return;
- }
-
- if (pInfo->ptFoot.y < rcClient.bottom) {
- CFX_FloatPoint pt = m_pContents->OutToIn(pInfo->ptFoot);
- pt.y += rcClient.Height();
- m_pContents->OnNotify(this, PNM_SCROLLWINDOW, SBT_VSCROLL,
- (intptr_t)&pt.y);
-
- CFX_FloatPoint ptScroll = m_pContents->GetScrollPos();
- m_pContentsBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL,
- (intptr_t)&ptScroll.y);
-
- return;
- }
- }
- }
- }
-
- CPWL_NoteItem::OnNotify(pWnd, msg, wParam, lParam);
-}
-
-void CPWL_Note::SetBkColor(const CPWL_Color& color) {
- CPWL_NoteItem::SetBkColor(color);
-
- CPWL_Color sBK = color;
- CPWL_Color sTextColor;
- if (CPWL_Utils::IsBlackOrWhite(sBK))
- sTextColor = PWL_DEFAULT_WHITECOLOR;
- else
- sTextColor = PWL_DEFAULT_BLACKCOLOR;
-
- if (m_pCloseBox)
- m_pCloseBox->SetTextColor(sTextColor);
- if (m_pAuthor)
- m_pAuthor->SetTextColor(sTextColor);
- if (m_pOptions)
- m_pOptions->SetTextColor(sTextColor);
- if (m_pLBBox)
- m_pLBBox->SetTextColor(sTextColor);
- if (m_pRBBox)
- m_pRBBox->SetTextColor(sTextColor);
-}
-
-FX_BOOL CPWL_Note::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) {
- if (m_pOptions->WndHitTest(m_pOptions->ParentToChild(point))) {
- if (IPWL_NoteNotify* pNotify = GetNoteNotify()) {
- int32_t x, y;
- PWLtoWnd(point, x, y);
- if (IFX_SystemHandler* pSH = GetSystemHandler())
- pSH->ClientToScreen(GetAttachedHWnd(), x, y);
- KillFocus();
- pNotify->OnPopupMenu(x, y);
-
- return TRUE;
- }
- }
-
- return CPWL_Wnd::OnLButtonDown(point, nFlag);
-}
-
-FX_BOOL CPWL_Note::OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) {
- return CPWL_Wnd::OnRButtonUp(point, nFlag);
-}
-
-const CPWL_Note* CPWL_Note::GetNote() const {
- return this;
-}
-
-IPWL_NoteNotify* CPWL_Note::GetNoteNotify() const {
- return m_bEnableNotify ? m_pNoteNotify : nullptr;
-}
-
-void CPWL_Note::SetIconType(int32_t nType) {
- if (m_pIcon)
- m_pIcon->SetIconType(nType);
-}
-
-void CPWL_Note::EnableModify(FX_BOOL bEnabled) {
- m_pContents->EnableModify(bEnabled);
-}
-
-void CPWL_Note::EnableRead(FX_BOOL bEnabled) {
- m_pContents->EnableRead(bEnabled);
-}
-
-CFX_WideString CPWL_Note::GetReplyString() const {
- return m_sReplyString;
-}
-
-void CPWL_Note::SetReplyString(const CFX_WideString& str) {
- m_sReplyString = str;
-}
diff --git a/fpdfsdk/pdfwindow/PWL_Note.h b/fpdfsdk/pdfwindow/PWL_Note.h
index 1068999134..e741f0f872 100644
--- a/fpdfsdk/pdfwindow/PWL_Note.h
+++ b/fpdfsdk/pdfwindow/PWL_Note.h
@@ -25,27 +25,8 @@ class CPWL_Note_Options;
class CPWL_Note_RBBox;
class IPWL_NoteHandler;
class IPWL_NoteItem;
-class IPWL_NoteNotify;
class IPopup_Note;
-class IPWL_NoteNotify {
- public:
- virtual ~IPWL_NoteNotify() {}
- virtual void OnNoteMove(const FX_RECT& rtWin) = 0;
- virtual void OnNoteShow(FX_BOOL bShow) = 0;
- virtual void OnNoteActivate(FX_BOOL bActive) = 0;
- virtual void OnNoteClose() = 0;
- virtual void OnItemCreate(IPWL_NoteItem* pItem) = 0;
- virtual void OnItemDelete(IPWL_NoteItem* pItem) = 0;
- virtual void OnSetAuthorName(IPWL_NoteItem* pItem) = 0;
- virtual void OnSetBkColor(IPWL_NoteItem* pItem) = 0;
- virtual void OnSetContents(IPWL_NoteItem* pItem) = 0;
- virtual void OnSetDateTime(IPWL_NoteItem* pItem) = 0;
- virtual void OnSetSubjectName(IPWL_NoteItem* pItem) = 0;
- virtual void OnPopupMenu(int32_t x, int32_t y) = 0;
- virtual void OnPopupMenu(IPWL_NoteItem* pItem, int32_t x, int32_t y) = 0;
-};
-
class IPWL_NoteHandler {
public:
virtual ~IPWL_NoteHandler() {}
@@ -58,14 +39,11 @@ class IPWL_NoteItem {
virtual void SetPrivateData(void* pData) = 0;
virtual void SetBkColor(const CPWL_Color& color) = 0;
virtual void SetSubjectName(const CFX_WideString& sName) = 0;
- virtual void SetAuthorName(const CFX_WideString& sName) = 0;
virtual void SetDateTime(FX_SYSTEMTIME time) = 0;
virtual void SetContents(const CFX_WideString& sContents) = 0;
- virtual IPWL_NoteItem* CreateSubItem() = 0;
virtual int32_t CountSubItems() const = 0;
virtual IPWL_NoteItem* GetSubItems(int32_t index) const = 0;
- virtual void DeleteSubItem(IPWL_NoteItem* pNoteItem) = 0;
virtual void SetFocus() = 0;
virtual IPWL_NoteItem* GetParentItem() const = 0;
@@ -191,8 +169,6 @@ class CPWL_Note_Contents : public CPWL_ListCtrl {
void SetText(const CFX_WideString& sText);
CFX_WideString GetText() const;
- CPWL_NoteItem* CreateSubItem();
- void DeleteSubItem(IPWL_NoteItem* pNoteItem);
int32_t CountSubItems() const;
IPWL_NoteItem* GetSubItems(int32_t index) const;
@@ -223,24 +199,17 @@ class CPWL_NoteItem : public CPWL_Wnd, public IPWL_NoteItem {
virtual FX_BOOL IsTopItem() const { return FALSE; }
- virtual void ResetSubjectName(int32_t nItemIndex);
void EnableRead(FX_BOOL bEnabled);
void EnableModify(FX_BOOL bEnabled);
- void OnContentsValidate();
- void OnCreateNoteItem();
-
// IPWL_NoteItem
void SetPrivateData(void* pData) override;
void SetBkColor(const CPWL_Color& color) override;
void SetSubjectName(const CFX_WideString& sName) override;
- void SetAuthorName(const CFX_WideString& sName) override;
void SetDateTime(FX_SYSTEMTIME time) override;
void SetContents(const CFX_WideString& sContents) override;
- IPWL_NoteItem* CreateSubItem() override;
int32_t CountSubItems() const override;
IPWL_NoteItem* GetSubItems(int32_t index) const override;
- void DeleteSubItem(IPWL_NoteItem* pNoteItem) override;
void SetFocus() override { SetNoteFocus(FALSE); }
IPWL_NoteItem* GetParentItem() const override;
void* GetPrivateData() const override;
@@ -266,15 +235,11 @@ class CPWL_NoteItem : public CPWL_Wnd, public IPWL_NoteItem {
FX_FLOAT GetItemLeftMargin() override;
FX_FLOAT GetItemRightMargin() override;
- CPWL_NoteItem* CreateNoteItem();
CPWL_NoteItem* GetParentNoteItem() const;
void SetNoteFocus(FX_BOOL bLast);
void PopupNoteItemMenu(const CFX_FloatPoint& point);
- virtual const CPWL_Note* GetNote() const;
- virtual IPWL_NoteNotify* GetNoteNotify() const;
-
protected:
CPWL_Label* m_pSubject;
CPWL_Label* m_pDateTime;
@@ -290,62 +255,4 @@ class CPWL_NoteItem : public CPWL_Wnd, public IPWL_NoteItem {
FX_BOOL m_bAllowModify;
};
-class CPWL_Note : public CPWL_NoteItem {
- public:
- CPWL_Note(IPopup_Note* pPopupNote,
- IPWL_NoteNotify* pNoteNotify,
- IPWL_NoteHandler* pNoteHandler);
- ~CPWL_Note() override;
-
- IPWL_NoteItem* Reply();
- void EnableNotify(FX_BOOL bEnabled);
- void SetIconType(int32_t nType);
- void SetOptionsText(const CFX_WideString& sText);
- void EnableRead(FX_BOOL bEnabled);
- void EnableModify(FX_BOOL bEnabled);
-
- CFX_WideString GetReplyString() const;
- void SetReplyString(const CFX_WideString& str);
-
- // CPWL_NoteItem
- void SetSubjectName(const CFX_WideString& sName) override;
- void SetAuthorName(const CFX_WideString& sName) override;
- CFX_WideString GetAuthorName() const override;
- void SetBkColor(const CPWL_Color& color) override;
- void ResetSubjectName(int32_t nItemIndex) override {}
- FX_BOOL IsTopItem() const override { return TRUE; }
- const CPWL_Note* GetNote() const override;
- IPWL_NoteNotify* GetNoteNotify() const override;
- FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override;
- FX_BOOL OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override;
- FX_BOOL OnMouseWheel(short zDelta,
- const CFX_FloatPoint& point,
- uint32_t nFlag) override;
- void RePosChildWnd() override;
- void CreateChildWnd(const PWL_CREATEPARAM& cp) override;
- void OnNotify(CPWL_Wnd* pWnd,
- uint32_t msg,
- intptr_t wParam = 0,
- intptr_t lParam = 0) override;
-
- protected:
- FX_BOOL ResetScrollBar();
- void RePosNoteChildren();
- FX_BOOL ScrollBarShouldVisible();
-
- private:
- CPWL_Label* m_pAuthor;
- CPWL_Note_Icon* m_pIcon;
- CPWL_Note_CloseBox* m_pCloseBox;
- CPWL_Note_LBBox* m_pLBBox;
- CPWL_Note_RBBox* m_pRBBox;
- CPWL_ScrollBar* m_pContentsBar;
- CPWL_Note_Options* m_pOptions;
- IPWL_NoteNotify* m_pNoteNotify;
- FX_BOOL m_bResizing;
- PWL_SCROLL_INFO m_OldScrollInfo;
- FX_BOOL m_bEnableNotify;
- CFX_WideString m_sReplyString;
-};
-
#endif // FPDFSDK_PDFWINDOW_PWL_NOTE_H_