void CPDFXFA_DocEnvironment::SetFocusWidget(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) { if (hDoc != m_pContext->GetXFADoc()) return; if (!hWidget) { CPDFSDK_Annot::ObservedPtr pNull; m_pContext->GetFormFillEnv()->SetFocusAnnot(&pNull); return; } int pageViewCount = m_pContext->GetFormFillEnv()->GetPageViewCount(); for (int i = 0; i < pageViewCount; i++) { CPDFSDK_PageView* pPageView = m_pContext->GetFormFillEnv()->GetPageView(i); if (!pPageView) continue; CPDFSDK_Annot::ObservedPtr pAnnot(pPageView->GetAnnotByXFAWidget(hWidget)); if (pAnnot) { m_pContext->GetFormFillEnv()->SetFocusAnnot(&pAnnot); break; } } }
void sUpdateCase(CDir& test_cases_dir, const string& test_name) { string input = CDir::ConcatPath( test_cases_dir.GetPath(), test_name + "." + extInput); string output = CDir::ConcatPath( test_cases_dir.GetPath(), test_name + "." + extOutput); string errors = CDir::ConcatPath( test_cases_dir.GetPath(), test_name + "." + extErrors); if (!CFile(input).Exists()) { BOOST_FAIL("input file " << input << " does not exist."); } string test_base, test_type; NStr::SplitInTwo(test_name, ".", test_base, test_type); cerr << "Creating new test case from " << input << " ..." << endl; CErrorLogger logger(errors); //get a scope CRef<CObjectManager> pObjMngr = CObjectManager::GetInstance(); CGBDataLoader::RegisterInObjectManager(*pObjMngr); CRef<CScope> pScope(new CScope(*pObjMngr)); pScope->AddDefaults(); //get a writer object CNcbiIfstream ifstr(input.c_str(), ios::binary); CObjectIStream* pI = CObjectIStream::Open(eSerial_AsnText, ifstr, eTakeOwnership); CNcbiOfstream ofstr(output.c_str()); CBedGraphWriter* pWriter = sGetWriter(*pScope, ofstr); if (test_type == "annot") { CRef<CSeq_annot> pAnnot(new CSeq_annot); *pI >> *pAnnot; pWriter->WriteHeader(); pWriter->WriteAnnot(*pAnnot); pWriter->WriteFooter(); delete pWriter; ofstr.flush(); }