XP_STRCPY(buf, "<A TARGET=Internal_URL_Info HREF=about:"); STREAM_WRITE(buf); STREAM_WRITE(url); XP_STRCPY(buf,">"); STREAM_WRITE(buf); STREAM_WRITE(url);
XP_STRCPY(buf, "<A TARGET=Internal_URL_Info HREF=\"about:"); STREAM_WRITE(buf); escaped = NET_EscapeDoubleQuote(url); STREAM_WRITE(escaped); PR_Free(escaped); XP_STRCPY(buf,"\">"); STREAM_WRITE(buf); escaped = NET_EscapeHTML(url); STREAM_WRITE(escaped); PR_Free(escaped);
LO_DocumentInfo(MWContext *context, NET_StreamClass *stream){	int32 doc_id, i;	lo_TopState *top_state;	lo_DocState *state;	LO_Element **line_array;	LO_Element *eptr;	/* stuff we want to return info on */	char *backdrop_image_url;	char *url;	char *base_url;	lo_FormData *form_list;	if (context == NULL)	{		return(-1);	}	/*	 * Get the unique document ID, and retreive this	 * documents layout state.	 */	doc_id = XP_DOCID(context);	top_state = lo_FetchTopState(doc_id);	if ((top_state == NULL)||(top_state->doc_state == NULL))	{		return(-1);	}	state = top_state->doc_state;	if (top_state->layout_status != PA_COMPLETE)	{		char buf[1024];		XP_STRCPY(buf, XP_GetString(LAY_PAGEINFO_NOINFO));		STREAM_WRITE(buf);		return(0);	}	/*	 * Extract the URL this document was accessed by.	 */	if (top_state->url != NULL)	{		char buf[1024];		url = XP_STRDUP(top_state->url);		XP_STRCPY(buf, "<A TARGET=Internal_URL_Info HREF=about:");		STREAM_WRITE(buf);		STREAM_WRITE(url);		XP_STRCPY(buf,">");		STREAM_WRITE(buf);		STREAM_WRITE(url);		XP_STRCPY(buf,"</A><UL>");		STREAM_WRITE(buf);		XP_FREE(url);	}	else	{		url = NULL;	}	/*	 * Extract the BASE URL for this document.	 */	if (top_state->base_url != NULL)	{		base_url = XP_STRDUP(top_state->base_url);	}	else	{		base_url = NULL;	}	/*	 * Extract the background image, NULL if none.	 */	backdrop_image_url = (char*)LO_GetLayerBackdropURL(top_state->doc_layer);    lo_backdrop_info(backdrop_image_url, stream);	/*	 * Is this a grid?  If so there is nothing but grid cells	 * in it.  Return after processing it.	 */	if (top_state->is_grid != FALSE)	{		lo_GridRec *the_grid;		int32 cell_count;		lo_GridCellRec *cell_list;		char buf[1024];		the_grid = top_state->the_grid;		if (the_grid == NULL)		{			XP_STRCPY(buf,"</UL>");			STREAM_WRITE(buf);			return(1);		}		/*		 * The number of cells may be less than		 * the rows * cols because of blank cells.		 */		cell_count = the_grid->cell_count;		cell_list = the_grid->cell_list;		while (cell_list != NULL)		{			char *cell_url;			MWContext *cell_context;			/*			 * Extract the cell's URL.			 */			if (cell_list->url != NULL)			{				cell_url = XP_STRDUP(cell_list->url);			}			else			{				cell_url = NULL;			}			/*			 * Extract the cell's window context.			 */			cell_context = cell_list->context;			XP_STRCPY(buf, XP_GetString(LAY_PAGEINFO_FRAME));			STREAM_WRITE(buf);			/* recurse and print if valid context */			if (cell_context != NULL)			{				LO_DocumentInfo(cell_context, stream);			}			cell_list = cell_list->next;		}		XP_STRCPY(buf,"</UL>");		STREAM_WRITE(buf);		return(1);	}	/*	 * Extract the list of all forms in this doc.	 */	form_list = top_state->doc_lists.form_list;    lo_form_info(form_list, stream);	/*	 * Now traverse the element list describing important elements.	 * Right now interesting elements are Images and Embeds.	 */	/*	 * Make eptr point to the start of the element chain	 * for this document.	 */#ifdef XP_WIN16	{		XP_Block *larray_array;		XP_LOCK_BLOCK(larray_array, XP_Block *, state->larray_array);		state->line_array = larray_array[0];		XP_UNLOCK_BLOCK(state->larray_array);	}#endif /* XP_WIN16 */	XP_LOCK_BLOCK(line_array, LO_Element **, state->line_array);	eptr = line_array[0];	XP_UNLOCK_BLOCK(state->line_array);	lo_element_info(eptr, stream);	lo_element_info(state->float_list, stream);    for (i = 0; i <= state->top_state->max_layer_num; i++) {        lo_LayerDocState *layer_state = state->top_state->layers[i];		char buf[1024];        char *name;        if (!layer_state)            continue;        if (layer_state->id == LO_DOCUMENT_LAYER_ID)            continue;		XP_STRCPY(buf, XP_GetString(LAY_PAGEINFO_LAYER));		STREAM_WRITE(buf);        if (layer_state->layer) {            name = CL_GetLayerName(layer_state->layer);            if (name)                STREAM_WRITE(name);        }        XP_STRCPY(buf, "<UL>");		STREAM_WRITE(buf);        /* Extract the backdrop of the layer if it exists */        backdrop_image_url = (char*)LO_GetLayerBackdropURL(layer_state->layer);        lo_backdrop_info(backdrop_image_url, stream);                /* Extract form info */        form_list = layer_state->doc_lists->form_list;        lo_form_info(form_list, stream);        /* And important element info */        if (layer_state->cell) {            LO_CellStruct *cell = layer_state->cell;            lo_element_info(cell->cell_list, stream);            lo_element_info(cell->cell_float_list, stream);        }        XP_STRCPY(buf, "</UL>");		STREAM_WRITE(buf);    }    	if(1)	  {		char buf[16];		XP_STRCPY(buf,"</UL>");		STREAM_WRITE(buf);	  }	return(1);}