Пример #1
0
CPDFSDK_PageView::~CPDFSDK_PageView()
{
    CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
    int nAnnotCount = m_fxAnnotArray.GetSize();

    for (int i=0; i<nAnnotCount; i++)
    {
        CPDFSDK_Annot* pAnnot = (CPDFSDK_Annot*)m_fxAnnotArray.GetAt(i);
        //if there is a focused annot on the page, we should kill the focus first.
        if(pAnnot == m_pSDKDoc->GetFocusAnnot())
            KillFocusAnnot();
        CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr();
        ASSERT(pAnnotHandlerMgr);
        pAnnotHandlerMgr->ReleaseAnnot(pAnnot);
    }
    m_fxAnnotArray.RemoveAll();

        delete m_pAnnotList;
        m_pAnnotList = NULL;

        m_page->RemovePrivateData((void*)m_page);
        if(m_bTakeOverPage) {
            delete m_page;
        }
}
Пример #2
0
FX_BOOL CPDFSDK_Document::SetFocusAnnot(CPDFSDK_Annot* pAnnot,FX_UINT nFlag)
{

    if(m_pFocusAnnot==pAnnot) return TRUE;

    if(m_pFocusAnnot)
    {
        if(!KillFocusAnnot(nFlag) ) return FALSE;
    }
    CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
    if(pAnnot && pPageView->IsValid())
    {
        CPDFSDK_AnnotHandlerMgr *pAnnotHandler=m_pEnv->GetAnnotHandlerMgr();

        if(pAnnotHandler&&!m_pFocusAnnot)
        {
            if (!pAnnotHandler->Annot_OnSetFocus(pAnnot,nFlag))
                return FALSE;
            if(!m_pFocusAnnot)
            {
                m_pFocusAnnot=pAnnot;
                return TRUE;
            }
        }
    }
    return FALSE;
}
Пример #3
0
void CPDFSDK_PageView::KillFocusAnnotIfNeeded() {
  // if there is a focused annot on the page, we should kill the focus first.
  if (CPDFSDK_Annot* focusedAnnot = m_pSDKDoc->GetFocusAnnot()) {
    auto it =
        std::find(m_fxAnnotArray.begin(), m_fxAnnotArray.end(), focusedAnnot);
    if (it != m_fxAnnotArray.end())
      KillFocusAnnot();
  }
}
Пример #4
0
FX_BOOL CPDFSDK_PageView::OnLButtonDown(const CPDF_Point& point,
                                        FX_UINT nFlag) {
  CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
  ASSERT(pEnv);
  CPDFSDK_Annot* pFXAnnot = GetFXWidgetAtPoint(point.x, point.y);
  if (!pFXAnnot) {
    KillFocusAnnot(nFlag);
    return FALSE;
  }

  CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr();
  FX_BOOL bRet =
      pAnnotHandlerMgr->Annot_OnLButtonDown(this, pFXAnnot, nFlag, point);
  if (bRet)
    SetFocusAnnot(pFXAnnot);
  return bRet;
}
Пример #5
0
void CPDFSDK_Document::OnCloseDocument()
{
    KillFocusAnnot();
}