diff options
author | Lei Zhang <thestig@chromium.org> | 2018-04-19 20:55:54 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-04-19 20:55:54 +0000 |
commit | ee96772e0878fa385b9a4a736a2fc109e19fd01e (patch) | |
tree | def5fed9024c0aef25d7d1f81729b6f0a6687179 /fpdfsdk/cpdfsdk_pageview.cpp | |
parent | c84ea8eda5a53229cf1faaed7cb54013b9ea18c3 (diff) | |
download | pdfium-ee96772e0878fa385b9a4a736a2fc109e19fd01e.tar.xz |
Add public APIs for undo / redo in forms.
Add FORM_CanUndo(), FORM_CanRedo(), FORM_Undo(), and FORM_Redo().
BUG=chromium:764260
Change-Id: I1d9ea67152d9b35d9b8e1d7ef7d019706fdfa30a
Reviewed-on: https://pdfium-review.googlesource.com/30872
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/cpdfsdk_pageview.cpp')
-rw-r--r-- | fpdfsdk/cpdfsdk_pageview.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp index b7f8cdfe10..b68828b144 100644 --- a/fpdfsdk/cpdfsdk_pageview.cpp +++ b/fpdfsdk/cpdfsdk_pageview.cpp @@ -268,6 +268,42 @@ void CPDFSDK_PageView::ReplaceSelection(const WideString& text) { } } +bool CPDFSDK_PageView::CanUndo() { + if (CPDFSDK_Annot* pAnnot = GetFocusAnnot()) { + CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = + m_pFormFillEnv->GetAnnotHandlerMgr(); + return pAnnotHandlerMgr->Annot_CanUndo(pAnnot); + } + return false; +} + +bool CPDFSDK_PageView::CanRedo() { + if (CPDFSDK_Annot* pAnnot = GetFocusAnnot()) { + CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = + m_pFormFillEnv->GetAnnotHandlerMgr(); + return pAnnotHandlerMgr->Annot_CanRedo(pAnnot); + } + return false; +} + +bool CPDFSDK_PageView::Undo() { + if (CPDFSDK_Annot* pAnnot = GetFocusAnnot()) { + CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = + m_pFormFillEnv->GetAnnotHandlerMgr(); + return pAnnotHandlerMgr->Annot_Undo(pAnnot); + } + return false; +} + +bool CPDFSDK_PageView::Redo() { + if (CPDFSDK_Annot* pAnnot = GetFocusAnnot()) { + CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = + m_pFormFillEnv->GetAnnotHandlerMgr(); + return pAnnotHandlerMgr->Annot_Redo(pAnnot); + } + return false; +} + bool CPDFSDK_PageView::OnFocus(const CFX_PointF& point, uint32_t nFlag) { CPDFSDK_Annot::ObservedPtr pAnnot(GetFXWidgetAtPoint(point)); if (!pAnnot) { |