bool GraphicsMgr::is_detached(UAS_Pointer<Graphic> &gr) { // iterate through the list looking for our graphic. // if our graphic is in the list, return True. // Otherwise, return False. List_Iterator<GraphicAgent*> dgl (&f_detached_list); for (; dgl; dgl++) { UAS_Pointer<Graphic> g = dgl.item()->graphic(); if (gr->locator() == g->locator()) { return True; } } return False; }
UAS_Pointer<UAS_EmbeddedObject> UAS_Factory::create_embedded (const UAS_String &locator, UAS_Pointer<UAS_Common> relative_to) { UAS_Factory *theFactory = get_factory (locator); if (theFactory != 0) { return theFactory->create_embedded_object (locator); } else { theFactory = get_factory (relative_to->locator()); return theFactory->create_relative_embedded_object(locator,relative_to); } }
void GraphicsMgr::reattach_graphic(UAS_Pointer<Graphic> &gr) { Wait_Cursor bob; gr->set_detached(FALSE); ReAttachGraphic rg(gr); UAS_Sender<ReAttachGraphic>::send_message(rg); UAS_String locator_str = gr->locator(); GraphicAgent *ga = get_agent(locator_str); remove_detached(ga); delete ga; }
DtSR_SearchResultsEntry::DtSR_SearchResultsEntry(const char* id, const char* book, const char* section, int dbn, short language, UAS_Pointer<DtSR_SearchResults>) : UAS_SearchResultsEntry(id, book, section, Inv_Relevance), f_dbn(dbn), f_language(language), f_zone(0) { int i; for (i=0; i<=UAS_SearchZones::uas_all; i++) f_proximity[i] = 0; UAS_String url("mmdb:LOCATOR="); url = url + id; UAS_Pointer<UAS_Common> sec = UAS_Common::create(url); f_id = sec->locator(); }
void printLocs (UAS_Pointer<UAS_Common> doc, int level) { for (int i = 0; i < level; i ++) cerr << " "; UAS_String theLoc = doc->locator(); if (level >= 2) { char buf[1024]; UAS_String loc = doc->id(); (void) sprintf (buf, "mmdb:LOCATOR=%s", (char *) loc); UAS_Pointer<UAS_Common> theDoc = UAS_Common::create(buf); cerr << (char *) theLoc << ", " << (char *) theDoc->title() << endl; } else { cerr << (char *) theLoc << endl; } UAS_List<UAS_Common> kids = doc->children(); for (i = 0; i < kids.length(); i ++) { printLocs (kids[i], level + 1); } }
void GraphicsMgr::remove_detached(GraphicAgent *ga) { // iterate through the list looking for our graphic. // if our graphic is in the list, return it. // Otherwise, return NULL. List_Iterator<GraphicAgent*> dgl (&f_detached_list); if (ga == NULL) { return; } UAS_Pointer<Graphic> oldgr = ga->graphic(); for (; dgl; dgl++) { UAS_Pointer<Graphic> gr(dgl.item()->graphic()); if (gr->locator() == oldgr->locator()) { f_detached_list.remove(ga); break; } } }
void UAS_Factory::destroyRoot (UAS_Pointer<UAS_Common> theRoot) { UAS_Factory *theFactory = get_factory (theRoot->locator()); if (theFactory) theFactory->destroy_root_object (theRoot); }