summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fsdk_annothandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/src/fsdk_annothandler.cpp')
-rw-r--r--fpdfsdk/src/fsdk_annothandler.cpp75
1 files changed, 53 insertions, 22 deletions
diff --git a/fpdfsdk/src/fsdk_annothandler.cpp b/fpdfsdk/src/fsdk_annothandler.cpp
index 9b008cd762..de7f7d9716 100644
--- a/fpdfsdk/src/fsdk_annothandler.cpp
+++ b/fpdfsdk/src/fsdk_annothandler.cpp
@@ -288,18 +288,35 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnSetFocus(CPDFSDK_Annot* pAnnot,
if (pAnnotHandler->OnSetFocus(pAnnot, nFlag))
{
CPDFSDK_PageView* pPage = pAnnot->GetPageView();
+ ASSERT(pPage != NULL);
+
pPage->GetSDKDocument();
+ // pDocument->SetTopmostAnnot(pAnnot);
+
return TRUE;
}
+ else
+ {
+ return FALSE;
+ }
}
+
return FALSE;
}
FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag)
{
- ASSERT(pAnnot);
+ ASSERT(pAnnot != NULL);
+
if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot))
- return pAnnotHandler->OnKillFocus(pAnnot, nFlag);
+ {
+ if (pAnnotHandler->OnKillFocus(pAnnot, nFlag))
+ {
+ return TRUE;
+ }
+ else
+ return FALSE;
+ }
return FALSE;
}
@@ -308,8 +325,9 @@ CPDF_Rect CPDFSDK_AnnotHandlerMgr::Annot_OnGetViewBBox(CPDFSDK_PageView *pPage
{
ASSERT(pAnnot);
if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot))
+ {
return pAnnotHandler->GetViewBBox(pPageView, pAnnot);
-
+ }
return pAnnot->GetRect();
}
@@ -318,7 +336,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnHitTest(CPDFSDK_PageView *pPageView, CP
ASSERT(pAnnot);
if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot))
{
- if (pAnnotHandler->CanAnswer(pAnnot))
+ if(pAnnotHandler->CanAnswer(pAnnot))
return pAnnotHandler->HitTest(pPageView, pAnnot, point);
}
return FALSE;
@@ -332,26 +350,38 @@ CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::GetNextAnnot(CPDFSDK_Annot* pSDKAnnot,F
FX_BOOL CPDFSDK_BFAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot)
{
+ ASSERT(pAnnot);
ASSERT(pAnnot->GetType() == "Widget");
- if (pAnnot->GetSubType() == BFFT_SIGNATURE)
- return FALSE;
+ CFX_ByteString sSubType = pAnnot->GetSubType();
- CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
- if (!pWidget->IsVisible())
- return FALSE;
+ if (sSubType == BFFT_SIGNATURE)
+ {
+ }
+ else
+ {
+ CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
+ if (!pWidget->IsVisible()) return FALSE;
+
+ int nFieldFlags = pWidget->GetFieldFlags();
+ if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) return FALSE;
+ if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON)
+ return TRUE;
+ else
+ {
+ CPDF_Page* pPage = pWidget->GetPDFPage();
+ ASSERT(pPage != NULL);
- int nFieldFlags = pWidget->GetFieldFlags();
- if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY)
- return FALSE;
+ CPDF_Document* pDocument = pPage->m_pDocument;
+ ASSERT(pDocument != NULL);
- if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON)
- return TRUE;
+ FX_DWORD dwPermissions = pDocument->GetUserPermissions();
+ return (dwPermissions&FPDFPERM_FILL_FORM) ||
+ (dwPermissions&FPDFPERM_ANNOT_FORM) ||
+ (dwPermissions&FPDFPERM_ANNOT_FORM);
+ }
+ }
- CPDF_Page* pPage = pWidget->GetPDFPage();
- CPDF_Document* pDocument = pPage->m_pDocument;
- FX_DWORD dwPermissions = pDocument->GetUserPermissions();
- return (dwPermissions & FPDFPERM_FILL_FORM) ||
- (dwPermissions & FPDFPERM_ANNOT_FORM);
+ return FALSE;
}
CPDFSDK_Annot* CPDFSDK_BFAnnotHandler::NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage)
@@ -843,11 +873,12 @@ void CPDFSDK_AnnotIterator::InsertSort(CFX_PtrArray &arrayList, AI_COMPARE pComp
int LyOrderCompare(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2)
{
- if (p1->GetLayoutOrder() < p2->GetLayoutOrder())
+ if(p1->GetLayoutOrder() < p2->GetLayoutOrder())
return -1;
- if (p1->GetLayoutOrder() > p2->GetLayoutOrder())
+ else if (p1->GetLayoutOrder() == p2->GetLayoutOrder())
+ return 0;
+ else
return 1;
- return 0;
}
FX_BOOL CPDFSDK_AnnotIterator::InitIteratorAnnotList(CPDFSDK_PageView* pPageView,CFX_PtrArray * pAnnotList)