CPDF_Rect CPDFSDK_XFAAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) { ASSERT(pAnnot != NULL); IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); ASSERT(pWidgetHandler != NULL); CFX_RectF rcBBox; XFA_ELEMENT eType = pWidgetHandler->GetDataAcc(pAnnot->GetXFAWidget())->GetUIType(); if (eType == XFA_ELEMENT_Signature) pWidgetHandler->GetBBox(pAnnot->GetXFAWidget(), rcBBox, XFA_WIDGETSTATUS_Visible, TRUE); else pWidgetHandler->GetBBox(pAnnot->GetXFAWidget(), rcBBox, 0); CFX_FloatRect rcWidget(rcBBox.left, rcBBox.top, rcBBox.left + rcBBox.width, rcBBox.top + rcBBox.height); rcWidget.left -= 1.0f; rcWidget.right += 1.0f; rcWidget.bottom -= 1.0f; rcWidget.top += 1.0f; return rcWidget; }
CFX_FloatRect CPDFSDK_XFAWidgetHandler::GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) { ASSERT(pAnnot); CFX_RectF rcBBox; XFA_Element eType = pAnnot->GetXFAWidget()->GetDataAcc()->GetUIType(); if (eType == XFA_Element::Signature) pAnnot->GetXFAWidget()->GetBBox(rcBBox, XFA_WidgetStatus_Visible, true); else pAnnot->GetXFAWidget()->GetBBox(rcBBox, XFA_WidgetStatus_None); CFX_FloatRect rcWidget(rcBBox.left, rcBBox.top, rcBBox.left + rcBBox.width, rcBBox.top + rcBBox.height); rcWidget.left -= 1.0f; rcWidget.right += 1.0f; rcWidget.bottom -= 1.0f; rcWidget.top += 1.0f; return rcWidget; }
int CSgSelectionPreparationBar::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CWnd::OnCreate(lpCreateStruct) == -1) return -1; //Create font 1 LOGFONT logFontBtn1, logFontBtn2, logFont3; XTPPaintManager()->GetRegularFont()->GetLogFont(&logFontBtn1); //logFontBtn1.lfHeight += 0.1; m_Font1.CreateFontIndirect(&logFontBtn1); XTPPaintManager()->GetRegularFont()->GetLogFont(&logFontBtn2); logFontBtn2.lfHeight += 2; m_Font2.CreateFontIndirect(&logFontBtn2); XTPPaintManager()->GetRegularFont()->GetLogFont(&logFont3); logFont3.lfHeight += 4; m_Font3.CreateFontIndirect(&logFont3); CRect rcClient; GetClientRect(&rcClient); // Create close button CRect rcElement(rcClient.right - 18 - 2/*- 6*/, rcClient.top, rcClient.right -2/*-0 - 6*/, rcClient.top+18); CRect rcButton; rcButton.SetRect(0,0, 16, 16); BOOL bCreate = m_btnCancelSelection.Create(_T(""), WS_CHILD | WS_VISIBLE /*| BS_PUSHBUTTON*/, rcButton, this, IDC_CANCELSELECTION); if(bCreate == TRUE) { SetButtonImage(&m_btnCancelSelection, IDR_CLOSE_SGHINTS, CSize(16, 16)); m_btnCancelSelection.SetFlatStyle(true); m_btnCancelSelection.SetTheme(xtpButtonThemeOffice2007); m_btnCancelSelection.SetShowFocus(FALSE); m_btnCancelSelection.SetTransparent(TRUE); } m_btnCancelSelection.SetWindowPos(NULL, rcElement.left, rcElement.top, rcElement.Width(), rcElement.Height(), SWP_NOZORDER); UINT nYPos = 7; CreateSgSelectionButtons(nYPos); CreateAudioButtons(nYPos); CreateSgSettingButtons(nYPos); UpdateDialogControls(this, FALSE); //SetTimer(13, 10, 0); if(m_pPresentationBar) { m_pPresentationBar->DestroyWindow(); m_pPresentationBar->CreateEx(WS_EX_LAYERED | WS_EX_TOPMOST | WS_EX_TOOLWINDOW, AfxRegisterWndClass(0,0,0,0), NULL, WS_POPUP | WS_VISIBLE, CRect(100, 100, 400, 200), this, 0); m_pPresentationBar->SetLayeredWindowAttributes(RGB(255, 255, 255), (255 * 30) / 100, LWA_ALPHA | LWA_COLORKEY); } if(m_pPresentationBar!=NULL && m_bShowPresentationBar) { m_pPresentationBar->ShowWindow(SW_SHOW); } if(m_pWidgetRef) { CRect rcWidget(0,0,100,80); if ( m_pWidgetRef->GetSafeHwnd() != NULL) m_pWidgetRef->GetWindowRect(rcWidget); m_pWidgetRef->DestroyWindow(); m_pWidgetRef->CreateEx(WS_EX_LAYERED | WS_EX_TOPMOST | WS_EX_TOOLWINDOW, AfxRegisterWndClass(0,0,0,0), NULL, WS_POPUP | WS_VISIBLE, CRect(100, 100, 400, 200), this, 0); m_pWidgetRef->StartSavePosition(); // hide it for mom. will be displayed manually. m_pWidgetRef->ShowWindow(SW_HIDE); m_pWidgetRef->UpdateWindowPlacement();// == false ) // m_pWidgetRef->SetWindowPos(NULL, 100, 100, rcWidget.Width(), rcWidget.Height(), SWP_NOZORDER); } UpdateDialogControls(this, FALSE); return 0; }
DLLEXPORT int STDCALL FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, double page_x, double page_y) { if (!hHandle) return -1; CPDF_Page* pPage = CPDFPageFromFPDFPage(page); if (pPage) { CPDF_InterForm interform(pPage->m_pDocument, FALSE); CPDF_FormControl* pFormCtrl = interform.GetControlAtPoint(pPage, static_cast<FX_FLOAT>(page_x), static_cast<FX_FLOAT>(page_y), nullptr); if (!pFormCtrl) return -1; CPDF_FormField* pFormField = pFormCtrl->GetField(); return pFormField ? pFormField->GetFieldType() : -1; } #ifdef PDF_ENABLE_XFA CPDFXFA_Page* pXFAPage = UnderlyingFromFPDFPage(page); if (!pXFAPage) return -1; IXFA_PageView* pPageView = pXFAPage->GetXFAPageView(); if (!pPageView) return -1; IXFA_DocView* pDocView = pPageView->GetDocView(); if (!pDocView) return -1; IXFA_WidgetHandler* pWidgetHandler = pDocView->GetWidgetHandler(); if (!pWidgetHandler) return -1; std::unique_ptr<IXFA_WidgetIterator, ReleaseDeleter<IXFA_WidgetIterator>> pWidgetIterator(pPageView->CreateWidgetIterator( XFA_TRAVERSEWAY_Form, XFA_WIDGETFILTER_Viewable | XFA_WIDGETFILTER_AllType)); if (!pWidgetIterator) return -1; IXFA_Widget* pXFAAnnot = pWidgetIterator->MoveToNext(); while (pXFAAnnot) { CFX_RectF rcBBox; pWidgetHandler->GetBBox(pXFAAnnot, rcBBox, 0); CFX_FloatRect rcWidget(rcBBox.left, rcBBox.top, rcBBox.left + rcBBox.width, rcBBox.top + rcBBox.height); rcWidget.left -= 1.0f; rcWidget.right += 1.0f; rcWidget.bottom -= 1.0f; rcWidget.top += 1.0f; if (rcWidget.Contains(static_cast<FX_FLOAT>(page_x), static_cast<FX_FLOAT>(page_y))) { return FPDF_FORMFIELD_XFA; } pXFAAnnot = pWidgetIterator->MoveToNext(); } #endif // PDF_ENABLE_XFA return -1; }