intrusive_ptr<Document> DocumentSourceUnwind::clonePath() const { /* For this to be valid, we must already have pNoUnwindDocument set, and have set up the vector of indices for that document in fieldIndex. */ assert(pNoUnwindDocument.get()); intrusive_ptr<Document> pClone(pNoUnwindDocument->clone()); intrusive_ptr<Document> pCurrent(pClone); const size_t n = fieldIndex.size(); assert(n); for(size_t i = 0; i < n; ++i) { const size_t fi = fieldIndex[i]; Document::FieldPair fp(pCurrent->getField(fi)); if (i + 1 < n) { /* For every object in the path but the last, clone it and continue on down. */ intrusive_ptr<Document> pNext( fp.second->getDocument()->clone()); pCurrent->setField(fi, fp.first, Value::createDocument(pNext)); pCurrent = pNext; } else { /* for the last, subsitute the next unwound value */ pCurrent->setField(fi, fp.first, pUnwindValue); } } return pClone; }
/** * Create a StubEdge for the edge after the intersection eiCurr. * The next intersection is provided * in case it is the endpoint for the stub edge. * Otherwise, the next point from the parent edge will be the endpoint. * * eiCurr will always be an EdgeIntersection, but eiNext may be null. */ void EdgeEndBuilder::createEdgeEndForNext(Edge *edge, vector<EdgeEnd*> *l, EdgeIntersection *eiCurr, EdgeIntersection *eiNext) { size_t iNext = eiCurr->segmentIndex + 1; // if there is no next edge there is nothing to do if (iNext>=edge->getNumPoints() && eiNext==nullptr) return; Coordinate pNext(edge->getCoordinate(iNext)); // if the next intersection is in the same segment as the current, use it as the endpoint if (eiNext!=nullptr && eiNext->segmentIndex==eiCurr->segmentIndex) pNext=eiNext->coord; EdgeEnd *e = new EdgeEnd(edge, eiCurr->coord, pNext, edge->getLabel()); //Debug.println(e); l->push_back(e); }
bool CPDFSDK_AnnotHandlerMgr::Annot_OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) { if (CPDFSDK_FormFillEnvironment::IsCTRLKeyDown(nFlag) || CPDFSDK_FormFillEnvironment::IsALTKeyDown(nFlag)) { return GetAnnotHandler(pAnnot)->OnKeyDown(pAnnot, nKeyCode, nFlag); } CPDFSDK_PageView* pPage = pAnnot->GetPageView(); CPDFSDK_Annot* pFocusAnnot = pPage->GetFocusAnnot(); if (pFocusAnnot && (nKeyCode == FWL_VKEY_Tab)) { CPDFSDK_Annot::ObservedPtr pNext(GetNextAnnot( pFocusAnnot, !CPDFSDK_FormFillEnvironment::IsSHIFTKeyDown(nFlag))); if (pNext && pNext.Get() != pFocusAnnot) { pPage->GetFormFillEnv()->SetFocusAnnot(&pNext); return true; } } return GetAnnotHandler(pAnnot)->OnKeyDown(pAnnot, nKeyCode, nFlag); }