lo_ScrapeElement(context, eptr);
lo_ScrapeElement(context, eptr, TRUE);
lo_ClipLines(MWContext *context, lo_DocState *state, int32 line){	int32 i;	int32 dy;	int32 block_watch;	LO_Element *start_clipping;	LO_Element *end_clipping;	LO_Element *eptr;	LO_Element *end_ptr;	LO_Element *end_last_line;	LO_Element *float_list;	LO_Element *float_ptr;#ifdef MEMORY_ARENAS		lo_arena *old_first_arena;	lo_arena *old_current_arena;	/*	 * Save off the current memory arena, and make a new one.	 */	old_first_arena = state->top_state->first_arena;	old_current_arena = state->top_state->current_arena;	state->top_state->first_arena = NULL;	state->top_state->current_arena = NULL;	lo_InitializeMemoryArena(state->top_state);	if (state->top_state->first_arena == NULL)	{		state->top_state->out_of_memory = TRUE;		state->top_state->first_arena = old_first_arena;		state->top_state->current_arena = old_current_arena;		return;	}#endif /* MEMORY_ARENAS */		/*	 * Clear the selection (if any).	 */	LO_HighlightSelection(context, FALSE);	state->selection_start = NULL;	state->selection_start_pos = 0;	state->selection_end = NULL;	state->selection_end_pos = 0;	/*	 * If there is a blocked element that changes, watch it and reset	 * it properly.	 */	block_watch = -1;	if (state->top_state->layout_blocking_element != NULL)	{		block_watch =		    state->top_state->layout_blocking_element->lo_any.ele_id;	}	dy = 0;	/*	 * Delete all elements in the lines being clipped off.	 */	start_clipping = lo_line_to_element(state, 0);	end_clipping = lo_line_to_element(state, line);	if ((end_clipping != NULL)&&(start_clipping != NULL))	{		dy = end_clipping->lo_any.y - start_clipping->lo_any.y;	}	while ((start_clipping != NULL)&&(start_clipping != end_clipping))	{		lo_ScrapeElement(context, start_clipping);		start_clipping = start_clipping->lo_any.next;	}	/*	 * Loop through all the lines after the clipped line.	 */	end_last_line = NULL;	for (i=0; i < (state->line_num - line - 1); i++)	{		LO_Element *line_start;		LO_Element *lptr;		/*		 * Find the start of this line, and the start of		 * the next line.		 */		eptr = lo_line_to_element(state, (line + i));		end_ptr = lo_line_to_element(state, (line + 1 + i));		if (eptr != NULL)		{			line_start = lo_duplicate_element(context, state,						block_watch, eptr);			lptr = line_start;			eptr = eptr->lo_any.next;		}		else		{			line_start = NULL;			lptr = NULL;		}		/*		 * Set the start of this new line into the line array.		 */		lo_set_element_to_line(state, line_start, i);		/*		 * Copy all the elements in the line.		 */		while (eptr != end_ptr)		{			lptr->lo_any.y -= dy;			if (lptr->type == LO_CELL)			{				lo_ShiftCell((LO_CellStruct *)lptr, 0, -dy);			}			else if (lptr->type == LO_IMAGE)			{				FE_ShiftImage(context, (LO_ImageStruct *)lptr);			}			lptr->lo_any.next = lo_duplicate_element(context, state,							block_watch, eptr);			if (lptr->lo_any.next == NULL)			{				break;			}			lptr->lo_any.next->lo_any.prev = lptr;			lptr = lptr->lo_any.next;			eptr = eptr->lo_any.next;		}		if (lptr != NULL)		{			lptr->lo_any.y -= dy;			if (lptr->type == LO_CELL)			{				lo_ShiftCell((LO_CellStruct *)lptr, 0, -dy);			}			else if (lptr->type == LO_IMAGE)			{				FE_ShiftImage(context, (LO_ImageStruct *)lptr);			}			lptr->lo_any.next = NULL;		}		/*		 * Link the beginning of the line we just copied to		 * the end of the last line.		 */		line_start->lo_any.prev = end_last_line;		if (end_last_line != NULL)		{			end_last_line->lo_any.next = line_start;		}		end_last_line = lptr;		lptr->lo_any.next = NULL;	}	/*	 * Clear the extra slots at the end.	 */	for (i = (state->line_num - line - 1); i < (state->line_num - 1); i++)	{		lo_set_element_to_line(state, NULL, i);	}	float_list = NULL;	float_ptr = NULL;	eptr = state->float_list;	while (eptr != NULL)	{		/*		 * Floating elements that move up off the top are deleted.		 */		if ((eptr->lo_any.y - dy) < 0)		{			lo_ScrapeElement(context, eptr);			eptr = eptr->lo_any.next;			continue;		}		if (float_list == NULL)		{			float_list = lo_duplicate_element(context, state,					block_watch, eptr);			float_ptr = float_list;		}		else		{			float_ptr->lo_any.next = lo_duplicate_element(context,						state, block_watch, eptr);			float_ptr = float_ptr->lo_any.next;		}		float_ptr->lo_any.y -= dy;		if (float_ptr->type == LO_CELL)		{			lo_ShiftCell((LO_CellStruct *)float_ptr, 0, -dy);		}		else if (float_ptr->type == LO_IMAGE)		{			FE_ShiftImage(context, (LO_ImageStruct *)float_ptr);		}		eptr = eptr->lo_any.next;	}	if (float_ptr != NULL)	{		float_ptr->lo_any.next = NULL;	}	/*	 * If there are blocked tags, one of them may be holded	 * a partially fetched blocked image element, duplicate it.	 */	if (state->top_state->tags != NULL)	{		PA_Tag *tag_ptr;		tag_ptr = state->top_state->tags;		while (tag_ptr != NULL)		{			if ((tag_ptr->type == P_IMAGE)&&				(tag_ptr->lo_data != NULL))			{				LO_Element *new_eptr;				LO_Element *eptr;				eptr = (LO_Element *)tag_ptr->lo_data;				new_eptr = lo_duplicate_element(context, state,                                                block_watch, eptr);				tag_ptr->lo_data = (void *)new_eptr;			}			tag_ptr = tag_ptr->next;		}	}	state->line_num -= line;	state->y -= dy;	state->end_last_line = end_last_line;	state->float_list = float_list;	state->current_ele = NULL;	lo_ShiftMarginsUp(context, state, dy);	/*	 * If we had a blocking element that didn't get duplicated, we don't	 * know what happened to it.	 */	if (block_watch != -1)	{		state->top_state->layout_blocking_element = NULL;	}#ifdef MEMORY_ARENAS		(void)lo_FreeMemoryArena(old_first_arena);#endif /* MEMORY_ARENAS	*/}